commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
805bfbca21e0a377324b0300051d9fae8884c541
Add interpolation hint tester.
eylvisaker/AgateLib
Tests/DisplayTests/Interpolation.cs
Tests/DisplayTests/Interpolation.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using AgateLib; using AgateLib.DisplayLib; using AgateLib.Geometry; namespace Tests.DisplayTests { class Interpolation : AgateLib.AgateApplication, IAgateTest { #region IAgateTest Members public string Name { get { return "Interpolation Mode"; } } public string Category { get { return "Display"; } } Surface surf, surf2; FontSurface font; protected override void Initialize() { surf = new Surface("jellybean.png"); surf2 = new Surface("jellybean.png"); font = new FontSurface("Arial", 14); surf.SetScale(6.0, 6.0); font.SetScale(3.0, 3.0); surf2.SetScale(6.0, 6.0); } protected override void Render() { Display.Clear(Color.Blue); surf.InterpolationHint = InterpolationMode.Fastest; surf.Draw(10, 10); font.DrawText(10, 500, "Chonky chonk chonk"); surf2.InterpolationHint = InterpolationMode.Fastest; surf2.Draw(500, 10); } #endregion #region IAgateTest Members public void Main(string[] args) { Run(args); } #endregion } }
mit
C#
2100d9228180a61c49031f218c725dcaf37b184d
fix merge issue
Fody/Fody,GeertvanHorrik/Fody
FodyHelpers/Testing/Class1.cs
FodyHelpers/Testing/Class1.cs
using System; using System.IO; using Mono.Cecil; using Mono.Cecil.Cil; namespace Fody { [Obsolete(OnlyForTesting.Message)] public class SymbolReaderProvider : ISymbolReaderProvider { DefaultSymbolReaderProvider inner; public SymbolReaderProvider() { inner = new DefaultSymbolReaderProvider(false); } public ISymbolReader GetSymbolReader(ModuleDefinition module, string fileName) { var symbolReader = inner.GetSymbolReader(module, fileName); if (symbolReader != null) { return symbolReader; } var uwpAssemblyPath = Path.ChangeExtension(fileName, "compile.dll"); return inner.GetSymbolReader(module, uwpAssemblyPath); } public ISymbolReader GetSymbolReader(ModuleDefinition module, Stream symbolStream) { throw new NotSupportedException(); } } }
mit
C#
8d25d2716ca9f828a0247c74553be54402734623
Create UriExtensions.cs
SirCmpwn/RedditSharp,theonlylawislove/RedditSharp,RobThree/RedditSharp,nyanpasudo/RedditSharp,justcool393/RedditSharp-1,pimanac/RedditSharp,epvanhouten/RedditSharp,CrustyJew/RedditSharp,chuggafan/RedditSharp-1,IAmAnubhavSaini/RedditSharp,Jinivus/RedditSharp,ekaralar/RedditSharpWindowsStore,angelotodaro/RedditSharp,tomnolan95/RedditSharp
RedditSharp/UriExtensions.cs
RedditSharp/UriExtensions.cs
using System; using System.Web; namespace RedditSharp { public static class UriExtensions { /// <summary> /// Adds the specified parameter to the Query String. /// </summary> /// <param name="url"></param> /// <param name="paramName">Name of the parameter to add.</param> /// <param name="paramValue">Value for the parameter to add.</param> /// <returns>Url with added parameter.</returns> public static Uri AddParameter(this Uri url, string paramName, object paramValue) { var uriBuilder = new UriBuilder(url); var query = HttpUtility.ParseQueryString(uriBuilder.Query); query[paramName] = paramValue.ToString(); uriBuilder.Query = query.ToString(); return new Uri(uriBuilder.ToString()); } } }
mit
C#
b51f147cd8f5153131a4efd7f989127be445632d
Add IPlatformIdentifier
tgstation/tgstation-server-tools,tgstation/tgstation-server,Cyberboss/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server
src/Tgstation.Server.Host/Core/IPlatformIdentifier.cs
src/Tgstation.Server.Host/Core/IPlatformIdentifier.cs
namespace Tgstation.Server.Host.Core { /// <summary> /// For identifying the current platform /// </summary> interface IPlatformIdentifier { /// <summary> /// If the current platform is a Windows platform /// </summary> bool IsWindows { get; } } }
agpl-3.0
C#
a9a590ca3a296126f2ce57b334b0729d619be328
Update ImplicitAnimationScreen.xib.cs according to code guideline
nelzomal/monotouch-samples,haithemaraissia/monotouch-samples,haithemaraissia/monotouch-samples,labdogg1003/monotouch-samples,markradacz/monotouch-samples,davidrynn/monotouch-samples,albertoms/monotouch-samples,nervevau2/monotouch-samples,robinlaide/monotouch-samples,robinlaide/monotouch-samples,kingyond/monotouch-samples,hongnguyenpro/monotouch-samples,peteryule/monotouch-samples,a9upam/monotouch-samples,haithemaraissia/monotouch-samples,kingyond/monotouch-samples,hongnguyenpro/monotouch-samples,a9upam/monotouch-samples,nervevau2/monotouch-samples,sakthivelnagarajan/monotouch-samples,andypaul/monotouch-samples,haithemaraissia/monotouch-samples,andypaul/monotouch-samples,markradacz/monotouch-samples,W3SS/monotouch-samples,labdogg1003/monotouch-samples,nelzomal/monotouch-samples,YOTOV-LIMITED/monotouch-samples,davidrynn/monotouch-samples,markradacz/monotouch-samples,labdogg1003/monotouch-samples,a9upam/monotouch-samples,hongnguyenpro/monotouch-samples,robinlaide/monotouch-samples,peteryule/monotouch-samples,davidrynn/monotouch-samples,iFreedive/monotouch-samples,W3SS/monotouch-samples,nelzomal/monotouch-samples,xamarin/monotouch-samples,robinlaide/monotouch-samples,davidrynn/monotouch-samples,hongnguyenpro/monotouch-samples,andypaul/monotouch-samples,YOTOV-LIMITED/monotouch-samples,nervevau2/monotouch-samples,YOTOV-LIMITED/monotouch-samples,sakthivelnagarajan/monotouch-samples,xamarin/monotouch-samples,xamarin/monotouch-samples,sakthivelnagarajan/monotouch-samples,YOTOV-LIMITED/monotouch-samples,labdogg1003/monotouch-samples,andypaul/monotouch-samples,iFreedive/monotouch-samples,albertoms/monotouch-samples,albertoms/monotouch-samples,kingyond/monotouch-samples,iFreedive/monotouch-samples,sakthivelnagarajan/monotouch-samples,nervevau2/monotouch-samples,peteryule/monotouch-samples,peteryule/monotouch-samples,W3SS/monotouch-samples,nelzomal/monotouch-samples,a9upam/monotouch-samples
CoreAnimation/Screens/iPad/LayerAnimation/ImplicitAnimationScreen.xib.cs
CoreAnimation/Screens/iPad/LayerAnimation/ImplicitAnimationScreen.xib.cs
using System; using System.Collections.Generic; using System.Linq; using MonoTouch.Foundation; using MonoTouch.UIKit; using MonoTouch.CoreAnimation; using System.Drawing; namespace Example_CoreAnimation.Screens.iPad.LayerAnimation { public partial class ImplicitAnimationScreen : UIViewController, IDetailView { public event EventHandler ContentsButtonClicked; protected CALayer imgLayer; #region Constructors // The IntPtr and initWithCoder constructors are required for controllers that need // to be able to be created from a xib rather than from managed code public ImplicitAnimationScreen (IntPtr handle) : base (handle) { Initialize (); } [Export ("initWithCoder:")] public ImplicitAnimationScreen (NSCoder coder) : base (coder) { Initialize (); } public ImplicitAnimationScreen () : base ("ImplicitAnimationScreen", null) { Initialize (); } void Initialize () { Console.WriteLine ("Creating Layer"); // create our layer and set it's frame imgLayer = CreateLayerFromImage (); imgLayer.Frame = new RectangleF (200, 70, 114, 114); // add the layer to the layer tree so that it's visible View.Layer.AddSublayer (imgLayer); } #endregion public override void ViewDidLoad () { base.ViewDidLoad (); btnContents.TouchUpInside += (sender, e) => { if (ContentsButtonClicked != null) ContentsButtonClicked (sender, e); }; // anonymous delegate that runs when the btnAnimate button is clicked btnAnimate.TouchUpInside += (s, e) => { if (imgLayer.Frame.Y == 70) { imgLayer.Frame = new RectangleF (new PointF (200, 270), imgLayer.Frame.Size); imgLayer.Opacity = 0.2f; } else { imgLayer.Frame = new RectangleF (new PointF (200, 70), imgLayer.Frame.Size); imgLayer.Opacity = 1.0f; } }; } //==== Ways to create a CALayer //==== Method 1: create a layer from an image protected CALayer CreateLayerFromImage () { var layer = new CALayer (); layer.Contents = UIImage.FromBundle ("icon-114.png").CGImage; return layer; } //==== Method 2: create a layer and assign a custom delegate that performs the drawing protected CALayer CreateLayerWithDelegate () { var layer = new CALayer (); layer.Delegate = new LayerDelegate (); return layer; } public class LayerDelegate : CALayerDelegate { public override void DrawLayer (CALayer layer, MonoTouch.CoreGraphics.CGContext context) { // implement your drawing } } //===== Method 3: Create a custom CALayer and override the appropriate methods public class MyCustomLayer : CALayer { public override void DrawInContext (MonoTouch.CoreGraphics.CGContext ctx) { base.DrawInContext (ctx); // implement your drawing } } } }
using System; using System.Collections.Generic; using System.Linq; using MonoTouch.Foundation; using MonoTouch.UIKit; using MonoTouch.CoreAnimation; using System.Drawing; namespace Example_CoreAnimation.Screens.iPad.LayerAnimation { public partial class ImplicitAnimationScreen : UIViewController, IDetailView { public event EventHandler ContentsButtonClicked; protected CALayer imgLayer; #region Constructors // The IntPtr and initWithCoder constructors are required for controllers that need // to be able to be created from a xib rather than from managed code public ImplicitAnimationScreen (IntPtr handle) : base(handle) { Initialize (); } [Export("initWithCoder:")] public ImplicitAnimationScreen (NSCoder coder) : base(coder) { Initialize (); } public ImplicitAnimationScreen () : base("ImplicitAnimationScreen", null) { Initialize (); } void Initialize () { Console.WriteLine("Creating Layer"); // create our layer and set it's frame imgLayer = this.CreateLayerFromImage(); imgLayer.Frame = new RectangleF (200, 70, 114, 114); // add the layer to the layer tree so that it's visible this.View.Layer.AddSublayer (imgLayer); } #endregion public override void ViewDidLoad () { base.ViewDidLoad (); btnContents.TouchUpInside += (sender, e) => { if(ContentsButtonClicked != null) ContentsButtonClicked(sender, e); }; // anonymous delegate that runs when the btnAnimate button is clicked btnAnimate.TouchUpInside += (s, e) => { if(imgLayer.Frame.Y == 70) { imgLayer.Frame = new RectangleF (new PointF (200, 270), imgLayer.Frame.Size); imgLayer.Opacity = 0.2f; } else { imgLayer.Frame = new RectangleF (new PointF (200, 70), imgLayer.Frame.Size); imgLayer.Opacity = 1.0f; } }; } //==== Ways to create a CALayer //==== Method 1: create a layer from an image protected CALayer CreateLayerFromImage () { CALayer layer = new CALayer (); layer.Contents = UIImage.FromBundle ("icon-114.png").CGImage; return layer; } //==== Method 2: create a layer and assign a custom delegate that performs the drawing protected CALayer CreateLayerWithDelegate () { CALayer layer = new CALayer (); layer.Delegate = new LayerDelegate (); return layer; } public class LayerDelegate : CALayerDelegate { public override void DrawLayer (CALayer layer, MonoTouch.CoreGraphics.CGContext context) { // implement your drawing } } //===== Method 3: Create a custom CALayer and override the appropriate methods public class MyCustomLayer : CALayer { public override void DrawInContext (MonoTouch.CoreGraphics.CGContext ctx) { base.DrawInContext (ctx); // implement your drawing } } } }
mit
C#
5f1f956d1711fdbf7afe04d589a459329e398bb5
Fix the omission on the interface declaration
RavenB/opensim,TomDataworks/opensim,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,RavenB/opensim,RavenB/opensim,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,TomDataworks/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,TomDataworks/opensim,TomDataworks/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC
OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Reflection; using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); /// <summary> /// Interface for communication between OpenSim modules and in-world scripts /// </summary> /// /// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages /// from scripts in OpenSim modules. public interface IScriptModuleComms { /// <summary> /// Modules can subscribe to this event to receive command invocations from in-world scripts /// </summary> event ScriptCommand OnScriptCommand; void RegisterScriptInvocation(object target, string method); Delegate[] GetScriptInvocationList(); Delegate LookupScriptInvocation(string fname); string LookupModInvocation(string fname); Type[] LookupTypeSignature(string fname); Type LookupReturnType(string fname); object InvokeOperation(UUID scriptId, string fname, params object[] parms); /// <summary> /// Send a link_message event to an in-world script /// </summary> /// <param name="scriptId"></param> /// <param name="code"></param> /// <param name="text"></param> /// <param name="key"></param> void DispatchReply(UUID scriptId, int code, string text, string key); // For use ONLY by the script API void RaiseEvent(UUID script, string id, string module, string command, string key); } }
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Reflection; using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); /// <summary> /// Interface for communication between OpenSim modules and in-world scripts /// </summary> /// /// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages /// from scripts in OpenSim modules. public interface IScriptModuleComms { /// <summary> /// Modules can subscribe to this event to receive command invocations from in-world scripts /// </summary> event ScriptCommand OnScriptCommand; void RegisterScriptInvocation(object target, MethodInfo mi); Delegate[] GetScriptInvocationList(); Delegate LookupScriptInvocation(string fname); string LookupModInvocation(string fname); Type[] LookupTypeSignature(string fname); Type LookupReturnType(string fname); object InvokeOperation(UUID scriptId, string fname, params object[] parms); /// <summary> /// Send a link_message event to an in-world script /// </summary> /// <param name="scriptId"></param> /// <param name="code"></param> /// <param name="text"></param> /// <param name="key"></param> void DispatchReply(UUID scriptId, int code, string text, string key); // For use ONLY by the script API void RaiseEvent(UUID script, string id, string module, string command, string key); } }
bsd-3-clause
C#
eeef7cebfba13fb066893b7249b43fe29e0a4f73
Define acceptable maps statically
will-hart/AnvilEditor,will-hart/AnvilEditor
AnvilEditor/Models/MapDefinitions.cs
AnvilEditor/Models/MapDefinitions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AnvilEditor.Models { internal class MapData { internal string ImageName; internal int MapXMin; internal int MapXMax; internal int MapYMin; internal int MapYMax; internal string Credits; internal List<string> Addons; internal string ToString() { return this.Credits + Environment.NewLine + Environment.NewLine + "Map X Minimum: " + this.MapXMin + Environment.NewLine + "Map X Maximum: " + this.MapXMax + Environment.NewLine + "Map Y Minimum: " + this.MapYMin + Environment.NewLine + "Map Y Maximum: " + this.MapYMax + Environment.NewLine + "Image Path: /data/maps/" + this.ImageName; } } internal class MapDefinitions { internal static readonly Dictionary<string, MapData> Maps = new Dictionary<string, MapData>() { { "Altis", new MapData() { ImageName="Altis.png", MapXMin=2000, MapXMax=30000, MapYMin=5000, MapYMax=26000, Credits="Map created by 10T from Arma3 in game images. Released under the Arma Public License Share Alike (APL-SA). See http://forums.bistudio.com/showthread.php?178671-Tiled-maps-Google-maps-compatible-(WIP)", Addons = new List<string>() } }, { "Stratis", new MapData() { ImageName="Stratis.png", MapXMin=1300, MapXMax=7700, MapYMin=200, MapYMax=8000, Credits="Map created by 10T from Arma3 in game images. Released under the Arma Public License Share Alike (APL-SA). See http://forums.bistudio.com/showthread.php?178671-Tiled-maps-Google-maps-compatible-(WIP)", Addons = new List<string>() } }, { "Takistan", new MapData() { ImageName="Takistan.png", MapXMin=1300, MapXMax=7700, MapYMin=200, MapYMax=8000, Credits="Map created by 10T from Arma3 in game images. Released under the Arma Public License Share Alike (APL-SA). See http://forums.bistudio.com/showthread.php?178671-Tiled-maps-Google-maps-compatible-(WIP)", Addons = new List<string>() } }, { "Zargabad", new MapData() { ImageName="Zargabad.png", MapXMin=1300, MapXMax=7700, MapYMin=200, MapYMax=8000, Credits="Map created by 10T from Arma3 in game images. Released under the Arma Public License Share Alike (APL-SA). See http://forums.bistudio.com/showthread.php?178671-Tiled-maps-Google-maps-compatible-(WIP)", Addons = new List<string>() } } }; internal static List<string> MapNames { get { return Maps.Keys.ToList(); } } } }
mit
C#
8f8152f910f726aa5e6964d4001f2142bf750137
Fix build error
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.DataProtection.Redis/Properties/AssemblyInfo.cs
src/Microsoft.AspNetCore.DataProtection.Redis/Properties/AssemblyInfo.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Reflection; using System.Resources; [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyCompany("Microsoft Corporation.")] [assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft ASP.NET Core")]
apache-2.0
C#
db519b449ba416b6c8cf2a8db5d0eee9a4615dd1
Add Debug.cs
60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope
QueueDataGraphic/QueueDataGraphic/CSharpFiles/Debug.cs
QueueDataGraphic/QueueDataGraphic/CSharpFiles/Debug.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace QueueDataGraphic.CSharpFiles { class Debug { } }
apache-2.0
C#
da3d06262769c18cb34252760430408c9f5017de
Create deleteElements.cs
Gytaco/RevitAPI,Gytaco/RevitAPI
Macros/CS/Elements/deleteElements.cs
Macros/CS/Elements/deleteElements.cs
/* This code will delete views, filters and view templates from your Project */ public void deleteElements() { //sets the variable to the current application Document doc = this.ActiveUIDocument.Document; //uses linq to select the views and templates to delete var ViewDelExport = from elem in new FilteredElementCollector(doc) .OfClass(typeof(View)) let type = elem as View where type.ViewType == ViewType.AreaPlan || type.ViewType == ViewType.CeilingPlan || type.ViewType == ViewType.ColumnSchedule || type.ViewType == ViewType.CostReport || type.ViewType == ViewType.Detail || type.ViewType == ViewType.DraftingView || type.ViewType == ViewType.Legend || type.ViewType == ViewType.LoadsReport || type.ViewType == ViewType.PanelSchedule || type.ViewType == ViewType.PresureLossReport || type.ViewType == ViewType.Rendering || type.ViewType == ViewType.Report || type.ViewType == ViewType.Section || type.ViewType == ViewType.ThreeD || type.ViewType == ViewType.Walkthrough || type.ViewType == ViewType.Elevation || type.ViewType == ViewType.Undefined || type.ViewType == ViewType.DrawingSheet || type.IsTemplate select type; //gets the element id's of the views and adds them to a list var deleteViews = ViewDelExport.Select(view => view.Id).ToList(); //gets all the element id's of the filters in a project var deletefilters = new FilteredElementCollector(doc).OfClass(typeof(ParameterFilterElement)) .WhereElementIsNotElementType().ToElementIds(); //create a new transaction Transaction tx = new Transaction(doc); //starts the new transaction tx.Start("Delete All View Templates"); //delete all the views doc.Delete(deleteViews); //delete the filters in the project doc.Delete(deletefilters); //commits the transaction tx.Commit(); }
mit
C#
f74cb6395988361006f117cdc22eec67ae1c14fa
扩展 json.net 库方法
personball/Moju.WeChatHelper
Moju.WeChatHelper/Menu/JsonExtend.cs
Moju.WeChatHelper/Menu/JsonExtend.cs
using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; namespace Moju.WeChatHelper { public static class JsonExtend { public static Button ToWeChatMenuButton(this JObject JObj) { if (JObj["type"] == null) { return new HasSubButton { Name = JObj["name"].ToString(), SubButton = ((JArray)JObj["sub_button"]).ToWeChatMenuButtonList().ToList() }; } else { switch (JObj["type"].ToString()) { case "click": { return JObj.ToObject<ClickButton>(); } case "view": { return JObj.ToObject<ViewButton>(); } default: { return null; } } } } public static IEnumerable<Button> ToWeChatMenuButtonList(this JArray JArr) { return from obj in JArr select ((JObject)obj).ToWeChatMenuButton(); } } }
mit
C#
0a427ace585fc0cdca09f295cf7d3db0d7d84fe8
Create ProviderContext.cs
hprose/hprose-dotnet
src/Hprose.RPC/Plugins/Reverse/ProviderContext.cs
src/Hprose.RPC/Plugins/Reverse/ProviderContext.cs
/*--------------------------------------------------------*\ | | | hprose | | | | Official WebSite: https://hprose.com | | | | ProviderContext.cs | | | | ProviderContext class for C#. | | | | LastModified: Feb 3, 2019 | | Author: Ma Bingyao <andot@hprose.com> | | | \*________________________________________________________*/ namespace Hprose.RPC.Plugins.Reverse { public class ProviderContext : Context { public Client Client { get; private set; } public Method Method { get; private set; } public ProviderContext(Client client, Method method) { Client = client; Method = method; } } }
mit
C#
92e9075589b2f9ba647d148b2a35c8e468f502cf
Add base class for path elements that has a good default implementation for Apply on Selection
Domysee/Pather.CSharp
src/Pather.CSharp/PathElements/PathElementBase.cs
src/Pather.CSharp/PathElements/PathElementBase.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Pather.CSharp.PathElements { public abstract class PathElementBase : IPathElement { public Selection Apply(Selection target) { var results = new List<object>(); foreach (var entriy in target.Entries) { results.Add(Apply(entriy)); } var result = new Selection(results); return result; } public abstract object Apply(object target); } }
mit
C#
7251d41deba1823276c129cb99e9d35823a1c094
Add request class
peppy/osu,ppy/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu
osu.Game/Online/API/Requests/CommentReportRequest.cs
osu.Game/Online/API/Requests/CommentReportRequest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Overlays.Comments; namespace osu.Game.Online.API.Requests { public class CommentReportRequest : APIRequest { public readonly long CommentID; public readonly CommentReportReason Reason; public readonly string? Info; public CommentReportRequest(long commentID, CommentReportReason reason, string? info) { CommentID = commentID; Reason = reason; Info = info; } protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); req.Method = HttpMethod.Post; req.AddParameter(@"reportable_type", @"comment"); req.AddParameter(@"reportable_id", $"{CommentID}"); req.AddParameter(@"reason", Reason.ToString()); if (!string.IsNullOrWhiteSpace(Info)) req.AddParameter(@"comments", Info); return req; } protected override string Target => @"reports"; } }
mit
C#
4e7ff1619ee5cebcca3390392cbc0df6303f72ef
Add AutoQueryable extension on top of Iqueryable<T>
trenoncourt/AutoQueryable
src/AutoQueryable/Extensions/QueryableExtension.cs
src/AutoQueryable/Extensions/QueryableExtension.cs
using System; using System.Linq; using AutoQueryable.Helpers; using AutoQueryable.Models; namespace AutoQueryable.Extensions { public static class QueryableExtension { public static dynamic AutoQueryable(this IQueryable<object> query, string queryString, AutoQueryableProfile profile) { Type entityType = query.GetType().GenericTypeArguments[0]; return QueryableHelper.GetAutoQuery(queryString, entityType, query, profile); } } }
mit
C#
d9feefce0a844e6bd8c945d6bd0f53ffff0ffcf1
Create Form2.cs
rus100/gomoku
Form2.cs
Form2.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace gomoku { public partial class Form2 : Form { public Form2() { InitializeComponent(); Class1.pc = radioButton2.Checked; Class1.znak = radioButton3.Checked; Class1.kolvohod = 0; Class1.time = 0; } private void button1_Click(object sender, EventArgs e) { Form1 f = new Form1(); this.Hide(); f.Show(); Class1.imya = textBox1.Text; if (checkBox1.Checked) { Class1.time1 = true; } else { Class1.time1 =false; } if (checkBox2.Checked) { Class1.kolvohod1 = true; } else { Class1.kolvohod1 = false; } } private void radioButton2_CheckedChanged(object sender, EventArgs e) { Class1.pc = radioButton2.Checked; } private void radioButton3_CheckedChanged(object sender, EventArgs e) { Class1.znak = radioButton3.Checked; } } }
unlicense
C#
14257e138ed277eb6839c2b8700f8cc65670c47d
Add closure
caronyan/CSharpRecipe
CSharpRecipe/Recipe.ClassAndGeneric/Closure.cs
CSharpRecipe/Recipe.ClassAndGeneric/Closure.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Recipe.ClassAndGeneric { public class SalesPerson { public SalesPerson() { } public SalesPerson(string name, decimal annualQuota, decimal commissionRate) { this.Name = name; this.AnnualQuota = annualQuota; this.CommissionRate = commissionRate; } private decimal _commission; public string Name { get; set; } public decimal AnnualQuota { get; set; } public decimal CommissionRate { get; set; } public decimal Commission { get { return _commission;} set { _commission = value; this.TotalCommission += _commission; } } public decimal TotalCommission { get; private set; } } delegate void CalculateEarnings(SalesPerson sp); public class TestCalc { static CalculateEarnings GetEarningsCalculator(decimal quarterlySales, decimal bonusRate) { return salesPerson => { decimal quarterlyQuota = (salesPerson.AnnualQuota/4); if (quarterlySales < quarterlyQuota) { salesPerson.Commission = 0; } else if (quarterlySales > (quarterlyQuota*2.0m)) { decimal baseCommission = quarterlyQuota*salesPerson.CommissionRate; salesPerson.Commission = (baseCommission + ((quarterlySales - quarterlyQuota)* (salesPerson.CommissionRate*(1 + bonusRate)))); } else { salesPerson.Commission = salesPerson.CommissionRate*quarterlySales; } }; } } }
mit
C#
34381e6748f2bf4929970ce1734eb5ad894c1d78
Add Extensions.Reflection test class
unosquare/swan
test/Unosquare.Swan.Test/ExtensionsReflectionTest.cs
test/Unosquare.Swan.Test/ExtensionsReflectionTest.cs
using NUnit.Framework; using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.InteropServices; using Unosquare.Swan; using Unosquare.Swan.Test.Mocks; namespace Unosquare.Swan.Test { [TestFixture] public class ExtensionsReflectionTest { [TestCase(null, typeof(Fish))] [TestCase(0, typeof(int))] public void GetDefaultTest(object expected, Type input) { Assert.AreEqual(expected, input.GetDefault(), "Get default of type"); } [TestCase(true, typeof(List<Fish>))] [TestCase(false, typeof(int))] public void IsCollectionTest(bool expected, Type input) { Assert.AreEqual(expected, input.IsCollection(), "Get IsCollection value"); } [TestCase(true, typeof(Fish))] [TestCase(false, typeof(int))] public void IsClassTest(bool expected, Type input) { Assert.AreEqual(expected, input.IsClass(), "Get IsClass value"); } [TestCase(true, typeof(IAnimal))] [TestCase(false, typeof(int))] public void IsAbstractTest(bool expected, Type input) { Assert.AreEqual(expected, input.IsAbstract(), "Get IsAbstract value"); } [TestCase(true, typeof(IAnimal))] [TestCase(false, typeof(int))] public void IsInterfaceTest(bool expected, Type input) { Assert.AreEqual(expected, input.IsInterface(), "Get IsAbstract value"); } [TestCase(true, typeof(int))] [TestCase(false, typeof(string))] public void IsPrimitiveTest(bool expected, Type input) { Assert.AreEqual(expected, input.IsPrimitive(), "Get IsPrimitive value"); } [TestCase(true, typeof(int))] [TestCase(false, typeof(Fish))] public void IsValueTypeTest(bool expected, Type input) { Assert.AreEqual(expected, input.IsPrimitive(), "Get IsValueType value"); } [TestCase(true, typeof(List<Fish>))] [TestCase(false, typeof(Fish))] public void IsGenericTypeTest(bool expected, Type input) { Assert.AreEqual(expected, input.IsGenericType(), "Get IsGenericType value"); } } }
mit
C#
e0e46ab9d2b56db05eb7553fc270389c5f8e8645
Create Client Message Context Factory
HelloKitty/GladNet2.0,HelloKitty/GladNet2,HelloKitty/GladNet2-Lidgren,HelloKitty/GladNet2-Lidgren,HelloKitty/GladNet2.0,HelloKitty/GladNet2
src/GladNet.Lidgren.Client/Network/Message/LidgrenClientMessageContextFactory.cs
src/GladNet.Lidgren.Client/Network/Message/LidgrenClientMessageContextFactory.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Lidgren.Network; using GladNet.Lidgren.Engine.Common; using GladNet.Serializer; namespace GladNet.Lidgren.Client { public class LidgrenClientMessageContextFactory : ILidgrenMessageContextFactory { private IDeserializerStrategy deserializer { get; } public LidgrenClientMessageContextFactory(IDeserializerStrategy deserializationStrategy) { if (deserializationStrategy == null) throw new ArgumentNullException(nameof(deserializationStrategy), $"Provided {nameof(IDeserializerStrategy)} cannot be null."); deserializer = deserializationStrategy; } public bool CanCreateContext(NetIncomingMessageType messageType) { return messageType == NetIncomingMessageType.StatusChanged || messageType == NetIncomingMessageType.Data; } public LidgrenMessageContext CreateContext(NetIncomingMessage message) { switch (message.MessageType) { //TODO: Do error messages //case NetIncomingMessageType.Error: // break; case NetIncomingMessageType.StatusChanged: return new LidgrenStatusChangeMessageContext(message); //returns a new status message context case NetIncomingMessageType.Data: return new LidgrenNetworkMessageMessageContext(message, deserializer); default: throw new InvalidOperationException($"Failed to generate Context for {message.MessageType}."); } } } }
bsd-3-clause
C#
8be90dff4f375a069d7b72e56e3afb28a1bfe28f
Add test for Guid
generik0/Smooth.IoC.Dapper.Repository.UnitOfWork,generik0/Smooth.IoC.Dapper.Repository.UnitOfWork
src/Smooth.IoC.Dapper.Repository.UnitOfWork.Tests/SpecialTests/MsSqlGuidTests.cs
src/Smooth.IoC.Dapper.Repository.UnitOfWork.Tests/SpecialTests/MsSqlGuidTests.cs
using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Data.SqlClient; using System.Reflection; using FakeItEasy; using NUnit.Framework; using SimpleMigrations; using Smooth.IoC.Dapper.Repository.UnitOfWork.Data; using System.IO; using System.Linq; using Dapper; using FluentAssertions; using SimpleMigrations.DatabaseProvider; using Smooth.IoC.Dapper.Repository.UnitOfWork.Repo; namespace Smooth.IoC.Dapper.FastCRUD.Repository.UnitOfWork.Tests.SpecialTests { [TestFixture] public class MsSqlGuidTests { private static TestSqlCeForGuid TestSession; private const string DbName = "TestMsSql"; [SetUp] public void TestSetup() { if(TestSession!=null) return; if (!File.Exists(DbName)) using (File.Create(DbName)) { } TestSession = new TestSqlCeForGuid(A.Fake<IDbFactory>()); var migrator = new SimpleMigrator(Assembly.GetExecutingAssembly(), new MssqlDatabaseProvider(TestSession.Connection as SqlConnection)); migrator.Load(); migrator.MigrateToLatest(); } [Test, Category("IntegrationMssqlCe"), Explicit] public void Insert_Returns_IdAsGuid() { var foo = new FooGuidTest {Something = "bar 1"}; TestSession.Execute("DELETE FROM FooGuidTest"); TestSession.Insert(foo); var actual = TestSession.Find<FooGuidTest>(); actual.Should().HaveCount(x => x > 0); actual.First().id.Should().NotBe(new Guid()); } [Test, Category("IntegrationMssqlCe"), Explicit] public void SaveAndUpdate_Returns_dAsGuid() { var foo = new FooGuidTest { Something = "bar 1" }; TestSession.Execute("DELETE FROM FooGuidTest"); var repo = new FooRepo1(A.Fake<IDbFactory>()); using (var uow= new Dapper.Repository.UnitOfWork.Data.UnitOfWork(A.Fake<IDbFactory>(), TestSession)) { repo.SaveOrUpdate(foo, uow); } var actual = repo.GetAll(TestSession); actual.Should().HaveCount(x => x > 0); actual.First().id.Should().NotBe(new Guid()); } [Migration(201612180930)] class CreateFoo : Migration { public override void Up() { if (!DB.ConnectionString.Contains(DbName)) return; Execute(@"CREATE TABLE FooGuidTest (Id UNIQUEIDENTIFIER DEFAULT NEWID(), Something VARCHAR(20) );"); } public override void Down() { Execute("DROP TABLE FooGuidTest"); } } class FooRepo1 : Repository<FooGuidTest, Guid> , IRepository<FooGuidTest, Guid> { public FooRepo1(IDbFactory factory) : base(factory) { } } [Table("FooGuidTest")] class FooGuidTest { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid id { get; set; } public string Something { get; set; } } class TestSqlCeForGuid : Session<SqlConnection>, ITestSqlCeForGuid { public TestSqlCeForGuid(IDbFactory session) : base(session, $@"Server=.\SQLEXPRESS;Database={DbName};Trusted_Connection=True;") { } } interface ITestSqlCeForGuid : ISession { } } }
mit
C#
5942385d0e95697dda1aac99e40d998b9bf8a2f4
Add the prim count interfaces
ft-/opensim-optimizations-wip-tests,RavenB/opensim,ft-/arribasim-dev-extras,ft-/arribasim-dev-extras,OpenSimian/opensimulator,RavenB/opensim,bravelittlescientist/opensim-performance,QuillLittlefeather/opensim-1,QuillLittlefeather/opensim-1,allquixotic/opensim-autobackup,OpenSimian/opensimulator,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,QuillLittlefeather/opensim-1,ft-/opensim-optimizations-wip-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,TomDataworks/opensim,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,BogusCurry/arribasim-dev,BogusCurry/arribasim-dev,TomDataworks/opensim,Michelle-Argus/ArribasimExtract,M-O-S-E-S/opensim,rryk/omp-server,ft-/opensim-optimizations-wip,Michelle-Argus/ArribasimExtract,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,QuillLittlefeather/opensim-1,OpenSimian/opensimulator,justinccdev/opensim,TomDataworks/opensim,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-extras,justinccdev/opensim,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,bravelittlescientist/opensim-performance,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,M-O-S-E-S/opensim,OpenSimian/opensimulator,bravelittlescientist/opensim-performance,allquixotic/opensim-autobackup,justinccdev/opensim,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-extras,justinccdev/opensim,Michelle-Argus/ArribasimExtract,TomDataworks/opensim,RavenB/opensim,justinccdev/opensim,TomDataworks/opensim,rryk/omp-server,allquixotic/opensim-autobackup,ft-/arribasim-dev-tests,BogusCurry/arribasim-dev,QuillLittlefeather/opensim-1,ft-/opensim-optimizations-wip-tests,ft-/arribasim-dev-extras,BogusCurry/arribasim-dev,BogusCurry/arribasim-dev,rryk/omp-server,allquixotic/opensim-autobackup,ft-/arribasim-dev-tests,ft-/arribasim-dev-tests,ft-/arribasim-dev-tests,BogusCurry/arribasim-dev,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-extras,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,ft-/opensim-optimizations-wip-tests,rryk/omp-server,allquixotic/opensim-autobackup,RavenB/opensim,justinccdev/opensim,bravelittlescientist/opensim-performance,allquixotic/opensim-autobackup,ft-/arribasim-dev-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,ft-/opensim-optimizations-wip-tests,RavenB/opensim,bravelittlescientist/opensim-performance,rryk/omp-server,OpenSimian/opensimulator,rryk/omp-server,OpenSimian/opensimulator,ft-/arribasim-dev-extras,M-O-S-E-S/opensim,TomDataworks/opensim,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip,bravelittlescientist/opensim-performance,Michelle-Argus/ArribasimExtract
OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs
OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using OpenMetaverse; using OpenSim.Framework; namespace OpenSim.Region.Framework.Interfaces { public interface IPrimCountModule { void TaintPrimCount(ILandObject land); void TaintPrimCount(int x, int y); void TaintPrimCount(); } public interface IPrimCounts { int Owner { get; } int Group { get; } int Others { get; } int Simulator { get; } IUserPrimCounts Users { get; } } public interface IUserPrimCounts { int this[UUID agentID] { get; } } }
bsd-3-clause
C#
a2121d8571991b7f39e2f3ecb53fe4c241ec13b6
Add UnitClassTests_Force
BrandonLWhite/UnitsNet,neutmute/UnitsNet,maherkassim/UnitsNet,BrandonLWhite/UnitsNet,Tirael/UnitsNet,maherkassim/UnitsNet,anjdreas/UnitsNet,anjdreas/UnitsNet,BoGrevyDynatest/UnitsNet
Tests/UnitsNet.ThirdParty.Tests/UnitClassTests_Force.cs
Tests/UnitsNet.ThirdParty.Tests/UnitClassTests_Force.cs
using System.Globalization; using System.Threading; using NUnit.Framework; using UnitsNet.Units; namespace UnitsNet.ThirdParty.Tests { // I don't know where to put these tests. They were intended to test UnitSystem via unit classes, // but I won't bother testing all the unit classes since they are generated from the same template. [TestFixture] public class UnitClassTests_Force { private readonly CultureInfo _russian = CultureInfo.GetCultureInfo("ru-RU"); private readonly CultureInfo _usEnglish = CultureInfo.GetCultureInfo("en-US"); private readonly Force _newton = new Force(1); private readonly Force _kgf = Force.FromKilogramsForce(1); [Test] public void ToStringUsesCurrentUICulture() { Thread.CurrentThread.CurrentUICulture = _russian; Assert.AreEqual("1 Н", _newton.ToString()); Thread.CurrentThread.CurrentUICulture = _usEnglish; Assert.AreEqual("1 N", _newton.ToString()); } [Test] public void ToStringUsesSpecifiedUnit() { Assert.AreEqual("1 N", _newton.ToString(ForceUnit.Newton)); Assert.AreEqual("1 kgf", _kgf.ToString(ForceUnit.KilogramForce)); } [Test] public void ToStringWithUnitUsesSpecifiedCulture() { Thread.CurrentThread.CurrentUICulture = _usEnglish; Assert.AreEqual("1 kgf", _kgf.ToString(ForceUnit.KilogramForce)); Thread.CurrentThread.CurrentUICulture = _russian; Assert.AreEqual("1 кгс", _kgf.ToString(ForceUnit.KilogramForce)); } [Test] public void ToStringUsesSpecifiedCulture() { Assert.AreEqual("1 kgf", _kgf.ToString(ForceUnit.KilogramForce, _usEnglish)); Assert.AreEqual("1 кгс", _kgf.ToString(ForceUnit.KilogramForce, _russian)); } [Test] public void ToStringUsesSpecifiedFormat() { // Test both string format pattern and number formatting. // Russian uses comma as decimal separator, US English uses dot. Assert.AreEqual("kgf 1.00", _kgf.ToString(ForceUnit.KilogramForce, _usEnglish, "{1} {0:0.00}")); Assert.AreEqual("1,00 кгс", _kgf.ToString(ForceUnit.KilogramForce, _russian, "{0:0.00} {1}")); } [Test] public void ToStringUsesSpecifiedArgs() { Assert.AreEqual("kgf 1.00 extra", _kgf.ToString(ForceUnit.KilogramForce, _usEnglish, "{1} {0:0.00} {2}", "extra")); } [Test] public void GetAbbreviationUsesSpecifiedUnit() { Assert.AreEqual("N", Force.GetAbbreviation(ForceUnit.Newton, _usEnglish)); Assert.AreEqual("kgf", Force.GetAbbreviation(ForceUnit.KilogramForce, _usEnglish)); } [Test] public void GetAbbreviationUsesSpecifiedCulture() { Assert.AreEqual("kgf", Force.GetAbbreviation(ForceUnit.KilogramForce, _usEnglish)); Assert.AreEqual("кгс", Force.GetAbbreviation(ForceUnit.KilogramForce, _russian)); } } }
mit
C#
ad0ce54f9eeb4fb999b65dbab73820c4445967d9
Revert "no message"
Darylcxz/ANIMA-SPIRIT
Assets/FireGate.cs
Assets/FireGate.cs
using UnityEngine; using System.Collections; public class FireGate : MonoBehaviour { bool fireTrigger; public GameObject LeftFire; public GameObject RightFire; public GameObject GateFire; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (LeftFire.GetComponent<ParticleSystem>().isPlaying && RightFire.GetComponent<ParticleSystem>().isPlaying) { GateFire.GetComponent<Animator>().SetBool("bFire", true); GameObject.FindGameObjectWithTag("stick").SetActive(false); } } void OnCollisionEnter(Collision col) { if (col.collider.tag == "dagger") { gameObject.transform.GetChild(0).GetComponent<ParticleSystem>().Play(); } } }
mit
C#
1e49078c526f2050a137f087cf0000f678f3484e
Add OsuCursorSprite
peppy/osu-new,peppy/osu,EVAST9919/osu,NeoAdonis/osu,2yangk23/osu,johnneijzen/osu,ppy/osu,EVAST9919/osu,2yangk23/osu,johnneijzen/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,UselessToucan/osu
osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorSprite.cs
osu.Game.Rulesets.Osu/UI/Cursor/OsuCursorSprite.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; namespace osu.Game.Rulesets.Osu.UI.Cursor { public class OsuCursorSprite : CompositeDrawable { public Drawable ExpandTarget { get; protected set; } } }
mit
C#
248f7d79569847952abb75ad967c54365e887a4e
Add tests directory for Mango.Server
jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos
src/Mango/Mango.Tests/Mango.Server/HttpRequestTest.cs
src/Mango/Mango.Tests/Mango.Server/HttpRequestTest.cs
using System; using NUnit.Framework; using Mango; using Mango.Server; namespace Mango.Tests { [TestFixture()] public class HttpRequestTest { [Test()] public void TestNoNullQueryData () { // var r = new HttpRequest (new MockHttpTransaction (), .... ); // Assert.NotNull (r.QueryData); } } }
mit
C#
81ead33b70f8aa161b4c1820e65748e58d45bc08
Create NickRichardson.cs
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/NickRichardson.cs
src/Firehose.Web/Authors/NickRichardson.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class NickRichardson : IAmACommunityMember, IFilterMyBlogPosts { public string FirstName => "Nick"; public string LastName => "Richardson"; public string ShortBioOrTagLine => "PowerShell | Automation | DevOps | VDI"; public string StateOrRegion => "Omaha, Nebraska"; public string EmailAddress => "nick@spiderzebra.com"; public string TwitterHandle => "ChiefNSR"; public string GravatarHash => "e0c2f09bf7f391bcf7aac9efc9325d67"; public string GitHubHandle => "n2501r"; public GeoPosition Position => new GeoPosition(41.257160, -95.995102); public Uri WebSite => new Uri("https://spiderzebra.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://spiderzebra.com/feed/"); } } public bool Filter(SyndicationItem item) { return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell")); } public string FeedLanguageCode => "en"; } }
mit
C#
95972dad0434802eed684574b7347f717885eb5d
Update Command_10_01.
CountrySideEngineer/Ev3Controller
dev/src/Ev3Controller/Ev3Command/Command_10_01.cs
dev/src/Ev3Controller/Ev3Command/Command_10_01.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ev3Controller.Ev3Command { public class Command_10_01 : ACommand_ResLenFix { #region Other methods and private properties in calling order /// <summary> /// Initialize parameter for command to send and response to be received, and its name. /// </summary> protected override void Init() { this.Name = "GetMotorPower"; this.Cmd = 0x10; this.SubCmd = 0x01; this.CmdLen = 0x00; this.Res = 0x11; this.SubRes = 0x01; this.ResLen = 0x08; base.Init(); } /// <summary> /// Setup command data , just only length byte. /// </summary> protected override void SetUp(ICommandParam CommandParam) { this.CmdData[(int)COMMAND_BUFF_INDEX.COMMAND_BUFF_INDEX_CMD_DATA_LEN] = this.CmdLen; } protected override void CheckParam() { int DataIndex = (int)RESPONSE_BUFF_INDEX.RESPONSE_BUFF_INDEX_RES_DATA_TOP; int DevNum = 4; for (int DevNumIndex = 0; DevNumIndex < DevNum; DevNumIndex++) { byte IsConnect = this.ResData[DataIndex++]; if ((IsConnect != 0x00) && (IsConnect != 0x01)) { throw new CommandOperationException( "InvalidConnectState", this.Cmd, this.SubCmd, this.Name); } byte MotorOutput = this.ResData[DataIndex++]; if (0x64 < MotorOutput) { throw new CommandOperationException( "InvalidMotorPower", this.Cmd, this.SubCmd, this.Name); } } } #endregion } }
mit
C#
6545b3e7039ada6058aaf99543441376e1a10541
Add comment to interop BOOL type
weltkante/corefx,lggomez/corefx,manu-silicon/corefx,benpye/corefx,cydhaselton/corefx,rjxby/corefx,ViktorHofer/corefx,ravimeda/corefx,tstringer/corefx,shimingsg/corefx,ptoonen/corefx,shmao/corefx,YoupHulsebos/corefx,alexperovich/corefx,gkhanna79/corefx,dhoehna/corefx,stone-li/corefx,lggomez/corefx,Chrisboh/corefx,shahid-pk/corefx,jlin177/corefx,nbarbettini/corefx,marksmeltzer/corefx,weltkante/corefx,nchikanov/corefx,nbarbettini/corefx,ViktorHofer/corefx,tstringer/corefx,kkurni/corefx,twsouthwick/corefx,mmitche/corefx,krytarowski/corefx,lggomez/corefx,elijah6/corefx,jhendrixMSFT/corefx,marksmeltzer/corefx,MaggieTsang/corefx,ViktorHofer/corefx,fgreinacher/corefx,billwert/corefx,Petermarcu/corefx,krk/corefx,alexperovich/corefx,tijoytom/corefx,ellismg/corefx,BrennanConroy/corefx,gkhanna79/corefx,jlin177/corefx,wtgodbe/corefx,alphonsekurian/corefx,dhoehna/corefx,mmitche/corefx,SGuyGe/corefx,ptoonen/corefx,lggomez/corefx,stone-li/corefx,ptoonen/corefx,axelheer/corefx,benjamin-bader/corefx,SGuyGe/corefx,shahid-pk/corefx,rahku/corefx,seanshpark/corefx,mazong1123/corefx,BrennanConroy/corefx,lggomez/corefx,seanshpark/corefx,dhoehna/corefx,khdang/corefx,richlander/corefx,shahid-pk/corefx,manu-silicon/corefx,richlander/corefx,tstringer/corefx,marksmeltzer/corefx,YoupHulsebos/corefx,BrennanConroy/corefx,jhendrixMSFT/corefx,tijoytom/corefx,elijah6/corefx,shmao/corefx,pallavit/corefx,alphonsekurian/corefx,jcme/corefx,manu-silicon/corefx,Petermarcu/corefx,Jiayili1/corefx,janhenke/corefx,kkurni/corefx,shahid-pk/corefx,rubo/corefx,elijah6/corefx,pallavit/corefx,rjxby/corefx,DnlHarvey/corefx,DnlHarvey/corefx,ptoonen/corefx,gkhanna79/corefx,cydhaselton/corefx,Petermarcu/corefx,fgreinacher/corefx,khdang/corefx,alexperovich/corefx,lggomez/corefx,ericstj/corefx,shmao/corefx,benjamin-bader/corefx,zhenlan/corefx,rahku/corefx,Ermiar/corefx,stephenmichaelf/corefx,alexperovich/corefx,the-dwyer/corefx,krytarowski/corefx,ericstj/corefx,billwert/corefx,iamjasonp/corefx,fgreinacher/corefx,Priya91/corefx-1,axelheer/corefx,wtgodbe/corefx,seanshpark/corefx,ellismg/corefx,alphonsekurian/corefx,ptoonen/corefx,pallavit/corefx,shimingsg/corefx,axelheer/corefx,SGuyGe/corefx,krytarowski/corefx,weltkante/corefx,cydhaselton/corefx,dsplaisted/corefx,nchikanov/corefx,khdang/corefx,khdang/corefx,gkhanna79/corefx,nchikanov/corefx,ellismg/corefx,shimingsg/corefx,jhendrixMSFT/corefx,Jiayili1/corefx,gkhanna79/corefx,jcme/corefx,krk/corefx,benpye/corefx,jhendrixMSFT/corefx,ericstj/corefx,mokchhya/corefx,rubo/corefx,cydhaselton/corefx,MaggieTsang/corefx,shimingsg/corefx,ellismg/corefx,ravimeda/corefx,DnlHarvey/corefx,nbarbettini/corefx,marksmeltzer/corefx,benjamin-bader/corefx,rahku/corefx,jlin177/corefx,twsouthwick/corefx,rjxby/corefx,pallavit/corefx,the-dwyer/corefx,mmitche/corefx,yizhang82/corefx,DnlHarvey/corefx,parjong/corefx,YoupHulsebos/corefx,Ermiar/corefx,ViktorHofer/corefx,tstringer/corefx,ptoonen/corefx,twsouthwick/corefx,billwert/corefx,benpye/corefx,janhenke/corefx,kkurni/corefx,Ermiar/corefx,rubo/corefx,nbarbettini/corefx,yizhang82/corefx,YoupHulsebos/corefx,cartermp/corefx,pallavit/corefx,jlin177/corefx,zhenlan/corefx,iamjasonp/corefx,benjamin-bader/corefx,rahku/corefx,Jiayili1/corefx,janhenke/corefx,twsouthwick/corefx,marksmeltzer/corefx,DnlHarvey/corefx,jlin177/corefx,MaggieTsang/corefx,richlander/corefx,YoupHulsebos/corefx,manu-silicon/corefx,mmitche/corefx,shmao/corefx,twsouthwick/corefx,cartermp/corefx,DnlHarvey/corefx,rahku/corefx,nbarbettini/corefx,zhenlan/corefx,the-dwyer/corefx,richlander/corefx,Petermarcu/corefx,mazong1123/corefx,billwert/corefx,nchikanov/corefx,stone-li/corefx,MaggieTsang/corefx,cydhaselton/corefx,rahku/corefx,shmao/corefx,the-dwyer/corefx,khdang/corefx,parjong/corefx,parjong/corefx,krk/corefx,tijoytom/corefx,benpye/corefx,dotnet-bot/corefx,stephenmichaelf/corefx,alexperovich/corefx,ellismg/corefx,ericstj/corefx,yizhang82/corefx,rjxby/corefx,benpye/corefx,yizhang82/corefx,cartermp/corefx,alexperovich/corefx,dhoehna/corefx,Jiayili1/corefx,iamjasonp/corefx,Priya91/corefx-1,SGuyGe/corefx,weltkante/corefx,the-dwyer/corefx,tstringer/corefx,jlin177/corefx,mokchhya/corefx,Petermarcu/corefx,krytarowski/corefx,the-dwyer/corefx,parjong/corefx,tijoytom/corefx,kkurni/corefx,shmao/corefx,Ermiar/corefx,Petermarcu/corefx,Chrisboh/corefx,stone-li/corefx,marksmeltzer/corefx,rahku/corefx,shahid-pk/corefx,parjong/corefx,elijah6/corefx,elijah6/corefx,Ermiar/corefx,janhenke/corefx,zhenlan/corefx,ericstj/corefx,MaggieTsang/corefx,Petermarcu/corefx,ravimeda/corefx,mazong1123/corefx,alphonsekurian/corefx,janhenke/corefx,JosephTremoulet/corefx,mokchhya/corefx,mokchhya/corefx,manu-silicon/corefx,elijah6/corefx,nchikanov/corefx,axelheer/corefx,dhoehna/corefx,richlander/corefx,dotnet-bot/corefx,ravimeda/corefx,zhenlan/corefx,ViktorHofer/corefx,krk/corefx,dotnet-bot/corefx,rjxby/corefx,dhoehna/corefx,SGuyGe/corefx,jhendrixMSFT/corefx,cartermp/corefx,axelheer/corefx,Jiayili1/corefx,stephenmichaelf/corefx,mokchhya/corefx,elijah6/corefx,stephenmichaelf/corefx,Chrisboh/corefx,pallavit/corefx,Priya91/corefx-1,JosephTremoulet/corefx,stephenmichaelf/corefx,rubo/corefx,kkurni/corefx,dotnet-bot/corefx,mazong1123/corefx,ellismg/corefx,jcme/corefx,jcme/corefx,yizhang82/corefx,shimingsg/corefx,nbarbettini/corefx,cartermp/corefx,dsplaisted/corefx,mazong1123/corefx,stone-li/corefx,mmitche/corefx,krytarowski/corefx,gkhanna79/corefx,ericstj/corefx,fgreinacher/corefx,benjamin-bader/corefx,billwert/corefx,nchikanov/corefx,dotnet-bot/corefx,Priya91/corefx-1,JosephTremoulet/corefx,parjong/corefx,wtgodbe/corefx,richlander/corefx,alexperovich/corefx,Ermiar/corefx,rjxby/corefx,tijoytom/corefx,shahid-pk/corefx,JosephTremoulet/corefx,adamralph/corefx,Chrisboh/corefx,axelheer/corefx,the-dwyer/corefx,janhenke/corefx,alphonsekurian/corefx,jcme/corefx,adamralph/corefx,richlander/corefx,shmao/corefx,yizhang82/corefx,cydhaselton/corefx,stephenmichaelf/corefx,weltkante/corefx,mazong1123/corefx,billwert/corefx,cartermp/corefx,gkhanna79/corefx,Chrisboh/corefx,nbarbettini/corefx,YoupHulsebos/corefx,manu-silicon/corefx,zhenlan/corefx,iamjasonp/corefx,tstringer/corefx,rjxby/corefx,Priya91/corefx-1,wtgodbe/corefx,JosephTremoulet/corefx,wtgodbe/corefx,jcme/corefx,wtgodbe/corefx,stone-li/corefx,benpye/corefx,alphonsekurian/corefx,ViktorHofer/corefx,ptoonen/corefx,alphonsekurian/corefx,Chrisboh/corefx,jhendrixMSFT/corefx,Jiayili1/corefx,iamjasonp/corefx,dotnet-bot/corefx,krytarowski/corefx,jhendrixMSFT/corefx,dotnet-bot/corefx,jlin177/corefx,shimingsg/corefx,iamjasonp/corefx,ravimeda/corefx,krk/corefx,JosephTremoulet/corefx,cydhaselton/corefx,krk/corefx,yizhang82/corefx,billwert/corefx,seanshpark/corefx,weltkante/corefx,stone-li/corefx,stephenmichaelf/corefx,mmitche/corefx,krk/corefx,ericstj/corefx,wtgodbe/corefx,DnlHarvey/corefx,twsouthwick/corefx,rubo/corefx,twsouthwick/corefx,shimingsg/corefx,lggomez/corefx,Ermiar/corefx,tijoytom/corefx,dhoehna/corefx,SGuyGe/corefx,dsplaisted/corefx,manu-silicon/corefx,nchikanov/corefx,seanshpark/corefx,MaggieTsang/corefx,zhenlan/corefx,Jiayili1/corefx,JosephTremoulet/corefx,mokchhya/corefx,tijoytom/corefx,benjamin-bader/corefx,mazong1123/corefx,ravimeda/corefx,ViktorHofer/corefx,krytarowski/corefx,weltkante/corefx,kkurni/corefx,mmitche/corefx,ravimeda/corefx,seanshpark/corefx,Priya91/corefx-1,marksmeltzer/corefx,MaggieTsang/corefx,khdang/corefx,iamjasonp/corefx,adamralph/corefx,YoupHulsebos/corefx,parjong/corefx,seanshpark/corefx
src/Common/src/Interop/Windows/Interop.BOOL.cs
src/Common/src/Interop/Windows/Interop.BOOL.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. internal partial class Interop { /// <summary> /// Blittable version of Windows BOOL type. It is convenient in situations where /// manual marshalling is required, or to avoid overhead of regular bool marshalling. /// </summary> /// <remarks> /// Some Windows APIs return arbitrary integer values although the return type is defined /// as BOOL. It is best to never compare BOOL to TRUE. Always use bResult != BOOL.FALSE /// or bResult == BOOL.FALSE . /// </remarks> internal enum BOOL : int { FALSE = 0, TRUE = 1, } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. internal partial class Interop { internal enum BOOL : int { FALSE = 0, TRUE = 1, } }
mit
C#
63aa1397d52744e69782132075f4a8991e8362c4
Add a passive check server with a store
RFQ-hub/ZabbixAgentLib
src/ZabbixAgent/PassiveCheckServerWithStore.cs
src/ZabbixAgent/PassiveCheckServerWithStore.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; using System.Net; namespace Itg.ZabbixAgent { public class PassiveCheckServerWithStore : PassiveCheckServerBase { private struct CounterId { public string Key { get; } public string Arguments { get; } public CounterId(string key, string arguments) { Key = key; Arguments = arguments; } public override bool Equals(object obj) { if (!(obj is CounterId)) { return false; } var id = (CounterId)obj; return Key == id.Key && Arguments == id.Arguments; } public override int GetHashCode() { var hashCode = -566015957; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Key); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Arguments); return hashCode; } } private readonly ConcurrentDictionary<CounterId, string> store = new ConcurrentDictionary<CounterId, string>(); public PassiveCheckServerWithStore(IPEndPoint endpoint) : base(endpoint) { } protected override PassiveCheckResult GetValue(string key, string args) { if (store.TryGetValue(new CounterId(key, args), out var value) && value != null) { return new PassiveCheckResult(value); } return PassiveCheckResult.NotSupported; } public void SetValue<T>(string key, string arguments, T value) { var counterId = new CounterId(key, arguments); if (value == null) { store.TryRemove(counterId, out _); } else { var stringValue = Convert.ToString(value, CultureInfo.InvariantCulture); store.AddOrUpdate(counterId, k => stringValue, (k, v) => stringValue); } } } }
mit
C#
6742f62cb51b73fff7bc90b31f22907380921592
Add AccessorPropertyGenerator
AspectCore/AspectCore-Framework,AspectCore/AspectCore-Framework,AspectCore/Abstractions,AspectCore/Lite
src/AspectCore.Abstractions.Resolution/Generators/AccessorPropertyGenerator.cs
src/AspectCore.Abstractions.Resolution/Generators/AccessorPropertyGenerator.cs
using AspectCore.Abstractions.Generator; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Reflection.Emit; using System.Reflection; namespace AspectCore.Abstractions.Resolution.Generators { internal class AccessorPropertyGenerator : PropertyGenerator { private readonly FieldBuilder fieldBuilder; public AccessorPropertyGenerator(TypeBuilder declaringMember) : base(declaringMember) { } public override CallingConventions CallingConventions { get; } = CallingConventions.HasThis; public override PropertyAttributes PropertyAttributes { get; } = PropertyAttributes.None; public override MethodInfo SetMethod { get { throw new NotImplementedException(); } } public override bool CanRead { get; } = true; public override bool CanWrite { get; } = false; public override MethodInfo GetMethod { get { throw new NotImplementedException(); } } public override string PropertyName { get; } public override Type PropertyType { get; } protected override MethodGenerator GetReadMethodGenerator(TypeBuilder declaringType) { throw new NotImplementedException(); } protected override MethodGenerator GetWriteMethodGenerator(TypeBuilder declaringType) { throw new NotImplementedException(); } } }
mit
C#
506feff58342f33b89af55e2d5e04e1136feeae2
add Upgrade_20211216_UpdateNugets
signumsoftware/framework,signumsoftware/framework
Signum.Upgrade/Upgrades/Upgrade_20211216_UpdateNugets.cs
Signum.Upgrade/Upgrades/Upgrade_20211216_UpdateNugets.cs
namespace Signum.Upgrade.Upgrades; class Upgrade_20211216_UpdateNugets : CodeUpgradeBase { public override string Description => "Update nugets"; public override void Execute(UpgradeContext uctx) { uctx.ForeachCodeFile(@"*.csproj", file => { file.UpdateNugetReference("Microsoft.TypeScript.MSBuild", "4.5.3"); file.UpdateNugetReference("Microsoft.VisualStudio.Azure.Containers.Tools.Targets", "1.14.0"); file.UpdateNugetReference("SciSharp.TensorFlow.Redist", "2.7.0"); file.UpdateNugetReference("Selenium.WebDriver", "4.1.0"); }); } }
mit
C#
a522ef442f511f82a376a315938bd14a16c5e821
Add VirtualPropertyExperiments
riganti/dotvvm-samples-academy,riganti/dotvvm-samples-academy,riganti/dotvvm-samples-academy
test/DotvvmAcademy.Validation.CSharp.Experiments/VirtualPropertyExperiments.cs
test/DotvvmAcademy.Validation.CSharp.Experiments/VirtualPropertyExperiments.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace DotvvmAcademy.Validation.CSharp.Experiments { public class VirtualPropertyExperiments { public class X1 { public string Property1 { get; set; } public int? Property2 { get; set; } } public abstract class X2 { public string Property3 { get; set; } public int? Property4 { get; set; } } public abstract class X3 : X2 { } [Fact] public void X1_SimpleClass_NotVirtual() { Assert.False(typeof(X1).GetProperty(nameof(X1.Property1)).GetMethod.IsVirtual); Assert.False(typeof(X1).GetProperty(nameof(X1.Property2)).GetMethod.IsVirtual); } [Fact] public void X2X3_InheritsAbstract_NotVirtual() { Assert.False(typeof(X3).GetProperty(nameof(X2.Property3)).GetMethod.IsVirtual); Assert.False(typeof(X3).GetProperty(nameof(X2.Property4)).GetMethod.IsVirtual); } } }
apache-2.0
C#
48ff8fe0d29503140006e8d8f2771983a0ecbb60
Add Broadcast Router tests.
SaxxonPike/NextLevelSeven
NextLevelSeven.Test/Routing/BroadcastRouterTests.cs
NextLevelSeven.Test/Routing/BroadcastRouterTests.cs
using System; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using NextLevelSeven.Routing; namespace NextLevelSeven.Test.Routing { [TestClass] public class BroadcastRouterTests { [TestMethod] public void BroadcastRouter_CanBeInitializedWithoutRoutes() { var router = new BroadcastRouter(); Assert.AreEqual(0, router.Routers.Count, "There should be no routers."); } [TestMethod] public void BroadcastRouter_CanBeInitializedWithRoutes() { var router = new BroadcastRouter(new NullRouter(true), new NullRouter(false)); Assert.AreEqual(2, router.Routers.Count, "There should be two routers."); } [TestMethod] public void BroadcastRouter_CanBeInitializedWithRoutesAsEnumerable() { var router = new BroadcastRouter(new IRouter[] { new NullRouter(true), new NullRouter(false) }.AsEnumerable()); Assert.AreEqual(2, router.Routers.Count, "There should be two routers."); } [TestMethod] public void BroadcastRouter_SendsMessages() { var subRouter1 = new NullRouter(true); var subRouter2 = new NullRouter(true); var router = new BroadcastRouter(subRouter1, subRouter2); router.Route(null); Assert.IsTrue(subRouter1.Checked, "Subrouter 1 should have been checked."); Assert.IsTrue(subRouter2.Checked, "Subrouter 2 should have been checked."); } [TestMethod] public void BroadcastRouter_IsSuccessfulWhenAtLeastOneRouteIsSuccessful() { var subRouter1 = new NullRouter(false); var subRouter2 = new NullRouter(true); var router = new BroadcastRouter(subRouter1, subRouter2); Assert.IsTrue(router.Route(null)); } [TestMethod] public void BroadcastRouter_IsNotSuccessfulWhenNoRoutesAreSuccessful() { var subRouter1 = new NullRouter(false); var subRouter2 = new NullRouter(false); var router = new BroadcastRouter(subRouter1, subRouter2); Assert.IsFalse(router.Route(null)); } } }
isc
C#
610bea79191ffb213a771aa3a68339608fef49f6
Add Selection class
Domysee/Pather.CSharp
src/Pather.CSharp/Selection.cs
src/Pather.CSharp/Selection.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Pather.CSharp { public class Selection { public IReadOnlyCollection<object> Entries { get; } public Selection(IEnumerable entries) { var list = new List<object>(); foreach (var entry in entries) list.Add(entry); Entries = list; } } }
mit
C#
1d7bb64b069e181071767c34ecd78a2ec665cd8b
Add legacy getfees
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Backend/Controllers/LegacyController.cs
WalletWasabi.Backend/Controllers/LegacyController.cs
using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; namespace WalletWasabi.Backend.Controllers { [Produces("application/json")] public class LegacyController : ControllerBase { public LegacyController(BlockchainController blockchainController) { BlockchainController = blockchainController; } public BlockchainController BlockchainController { get; } [HttpGet("api/v3/btc/Blockchain/all-fees")] [ResponseCache(Duration = 300, Location = ResponseCacheLocation.Client)] public async Task<IActionResult> GetAllFeesV3Async([FromQuery, Required] string estimateSmartFeeMode) => await BlockchainController.GetAllFeesAsync(estimateSmartFeeMode); } }
mit
C#
fba49ae71d74e219e3c7d7fecfb6a0caa5d42a4f
Fix XML description for HDI Pig "defines" prop
pomortaz/azure-sdk-for-net,naveedaz/azure-sdk-for-net,amarzavery/azure-sdk-for-net,oburlacu/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,nacaspi/azure-sdk-for-net,pomortaz/azure-sdk-for-net,vladca/azure-sdk-for-net,juvchan/azure-sdk-for-net,yoreddy/azure-sdk-for-net,rohmano/azure-sdk-for-net,amarzavery/azure-sdk-for-net,AuxMon/azure-sdk-for-net,juvchan/azure-sdk-for-net,dasha91/azure-sdk-for-net,kagamsft/azure-sdk-for-net,Nilambari/azure-sdk-for-net,pomortaz/azure-sdk-for-net,naveedaz/azure-sdk-for-net,abhing/azure-sdk-for-net,bgold09/azure-sdk-for-net,abhing/azure-sdk-for-net,ailn/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,jtlibing/azure-sdk-for-net,Nilambari/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,dasha91/azure-sdk-for-net,jtlibing/azure-sdk-for-net,bgold09/azure-sdk-for-net,hovsepm/azure-sdk-for-net,shuagarw/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,pattipaka/azure-sdk-for-net,herveyw/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,kagamsft/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,hovsepm/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,nemanja88/azure-sdk-for-net,nacaspi/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,shuagarw/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,bgold09/azure-sdk-for-net,akromm/azure-sdk-for-net,oburlacu/azure-sdk-for-net,AuxMon/azure-sdk-for-net,pattipaka/azure-sdk-for-net,ailn/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,nemanja88/azure-sdk-for-net,dasha91/azure-sdk-for-net,nemanja88/azure-sdk-for-net,naveedaz/azure-sdk-for-net,jtlibing/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,ailn/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,dominiqa/azure-sdk-for-net,herveyw/azure-sdk-for-net,pattipaka/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,vladca/azure-sdk-for-net,abhing/azure-sdk-for-net,yoreddy/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,hovsepm/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,shuagarw/azure-sdk-for-net,dominiqa/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,rohmano/azure-sdk-for-net,gubookgu/azure-sdk-for-net,dominiqa/azure-sdk-for-net,juvchan/azure-sdk-for-net,vladca/azure-sdk-for-net,herveyw/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,Nilambari/azure-sdk-for-net,akromm/azure-sdk-for-net,amarzavery/azure-sdk-for-net,kagamsft/azure-sdk-for-net,akromm/azure-sdk-for-net,gubookgu/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,gubookgu/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,oburlacu/azure-sdk-for-net,AuxMon/azure-sdk-for-net,rohmano/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,yoreddy/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net
src/ResourceManagement/DataFactory/DataFactoryManagement/Customizations/Models/Activities/HDInsightPigActivity.cs
src/ResourceManagement/DataFactory/DataFactoryManagement/Customizations/Models/Activities/HDInsightPigActivity.cs
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Collections.Generic; namespace Microsoft.Azure.Management.DataFactories.Models { /// <summary> /// Pig activity which runs on HDInsight. /// </summary> [AdfTypeName("HDInsightPig")] public class HDInsightPigActivity : HDInsightActivityBase { /// <summary> /// Hive script. /// </summary> public string Script { get; set; } /// <summary> /// Path to the script in blob storage. /// </summary> public string ScriptPath { get; set; } /// <summary> /// Storage linked service where the script file is located. /// </summary> public string ScriptLinkedService { get; set; } /// <summary> /// Allows user to specify defines for the Pig job request. /// </summary> public IDictionary<string, string> Defines { get; set; } public HDInsightPigActivity() { this.Defines = new Dictionary<string, string>(); } } }
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Collections.Generic; namespace Microsoft.Azure.Management.DataFactories.Models { /// <summary> /// Pig activity which runs on HDInsight. /// </summary> [AdfTypeName("HDInsightPig")] public class HDInsightPigActivity : HDInsightActivityBase { /// <summary> /// Hive script. /// </summary> public string Script { get; set; } /// <summary> /// Path to the script in blob storage. /// </summary> public string ScriptPath { get; set; } /// <summary> /// Storage linked service where the script file is located. /// </summary> public string ScriptLinkedService { get; set; } /// <summary> /// User specified property bag used in Pig scripts. There is no restriction on the /// keys or values that can be used. User needs to consume and interpret the content accordingly in /// their customized Pig script. /// </summary> public IDictionary<string, string> Defines { get; set; } public HDInsightPigActivity() { this.Defines = new Dictionary<string, string>(); } } }
apache-2.0
C#
03cd3270285ad24840349e803057cc45128c523c
add update language tests
mzrimsek/resume-site-api
Test.Integration/ControllerTests/LanguageControllerTests/UpdateLanguageShould.cs
Test.Integration/ControllerTests/LanguageControllerTests/UpdateLanguageShould.cs
using Microsoft.AspNetCore.TestHost; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Net; using System.Net.Http; using Test.Integration.TestHelpers; using Web.Models.LanguageModels; namespace Test.Integration.ControllerTests.LanguageControllerTests { [TestClass] public class UpdateLanguageShould { private TestServer _server; private HttpClient _client; private TestObjectCreator _testObjectCreator; private int _languageId; [TestInitialize] public void SetUp() { (_server, _client) = new TestSetupHelper().GetTestServerAndClient(); _testObjectCreator = new TestObjectCreator(_client); } [TestCleanup] public void TearDown() { var _ = _client.DeleteAsync($"{ControllerRouteEnum.LANGUAGE}/{_languageId}").Result; _client.Dispose(); _server.Dispose(); } [TestMethod] public void ReturnStatusCodeNotFound_WhenGivenInvalidId() { var model = TestObjectGetter.GetAddUpdateLanguageViewModel("A different language", 1); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PutAsync($"{ControllerRouteEnum.LANGUAGE}/1", requestContent).Result; Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode); } [TestMethod] public void ReturnStatusCodeBadRequest_WhenGivenInvalidModel_WithInvalidName() { _languageId = _testObjectCreator.GetIdFromNewLanguage(); var model = TestObjectGetter.GetAddUpdateLanguageViewModel(null, 1); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PutAsync($"{ControllerRouteEnum.LANGUAGE}/{_languageId}", requestContent).Result; Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); } [TestMethod] public void ReturnStatusCodeBadRequest_WhenGivenInvalidModel_WithInvalidRating() { _languageId = _testObjectCreator.GetIdFromNewLanguage(); var model = TestObjectGetter.GetAddUpdateLanguageViewModel("A different language", 4); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PutAsync($"{ControllerRouteEnum.LANGUAGE}/{_languageId}", requestContent).Result; Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); } [TestMethod] public void ReturnStatusCodeOk_WhenGivenValidIdAndValidModel() { _languageId = _testObjectCreator.GetIdFromNewLanguage(); var model = TestObjectGetter.GetAddUpdateLanguageViewModel("A different language", 2); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PutAsync($"{ControllerRouteEnum.LANGUAGE}/{_languageId}", requestContent).Result; Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); } [TestMethod] public void ReturnUpdatedViewModel() { _languageId = _testObjectCreator.GetIdFromNewLanguage(); var model = TestObjectGetter.GetAddUpdateLanguageViewModel("A different language", 2); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PutAsync($"{ControllerRouteEnum.LANGUAGE}/{_languageId}", requestContent).Result; var serializedContent = RequestHelper.GetObjectFromResponseContent<LanguageViewModel>(response); var isCorrectViewModel = AssertHelper.AreLanguageViewModelsEqual(model, serializedContent); Assert.IsTrue(isCorrectViewModel); } [TestMethod] public void SaveUpdatedViewModel() { _languageId = _testObjectCreator.GetIdFromNewLanguage(); var model = TestObjectGetter.GetAddUpdateLanguageViewModel("A different language", 2); var requestContent = RequestHelper.GetRequestContentFromObject(model); var _ = _client.PutAsync($"{ControllerRouteEnum.LANGUAGE}/{_languageId}", requestContent).Result; var response = _client.GetAsync($"{ControllerRouteEnum.LANGUAGE}/{_languageId}").Result; var serializedContent = RequestHelper.GetObjectFromResponseContent<LanguageViewModel>(response); var isCorrectViewModel = AssertHelper.AreLanguageViewModelsEqual(model, serializedContent); Assert.IsTrue(isCorrectViewModel); } } }
mit
C#
8c0dd50819cbd34d2b490671b646c2d5aaca69e9
Add test
sakapon/KLibrary.Linq
KLibrary4/UnitTest/Linq/ComparisonTest.cs
KLibrary4/UnitTest/Linq/ComparisonTest.cs
using System; using System.Collections.Generic; using KLibrary.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace UnitTest.Linq { [TestClass] public class ComparisonTest { [TestMethod] public void CreateComparer() { Assert.AreEqual(-1, Comparer<int>.Default.Compare(1, 2)); Assert.AreEqual(-1, Comparer<int>.Create((x, y) => x.CompareTo(y)).Compare(1, 2)); Assert.AreEqual(1, Comparer<int>.Create((x, y) => -x.CompareTo(y)).Compare(1, 2)); Assert.AreEqual(-1, Comparison.CreateComparer<int>((x, y) => x.CompareTo(y)).Compare(1, 2)); Assert.AreEqual(1, Comparison.CreateComparer<int>((x, y) => -x.CompareTo(y)).Compare(1, 2)); } [TestMethod] public void CreateEqualityComparer() { Assert.AreEqual(true, EqualityComparer<int>.Default.Equals(2, 2)); Assert.AreEqual(false, EqualityComparer<int>.Default.Equals(1, 2)); var comparer = Comparison.CreateEqualityComparer<string>((x, y) => string.Equals(x, y, StringComparison.InvariantCultureIgnoreCase)); Assert.AreEqual(true, comparer.Equals("abc", "ABC")); Assert.AreEqual(false, comparer.Equals("abcd", "ABC")); } } }
mit
C#
32ab51cb8ec6c1fc98b4db862f4c020c88e9f7aa
Introduce ModifierMarkerNameBuilder
JakeGinnivan/ApiApprover
src/PublicApiGenerator/ModifierMarkerNameBuilder.cs
src/PublicApiGenerator/ModifierMarkerNameBuilder.cs
using System.CodeDom; using Mono.Cecil; using static System.String; namespace PublicApiGenerator { static class ModifierMarkerNameBuilder { public static string Build(MethodDefinition methodDefinition, MemberAttributes getAccessorAttributes, bool? isNew, string name, string markerTemplate) { return (getAccessorAttributes & MemberAttributes.ScopeMask, isNew, methodDefinition.IsVirtual, methodDefinition.IsAbstract) switch { (MemberAttributes.Static, null, _, _) => Format(markerTemplate, "static") + name, (MemberAttributes.Static, true, _, _) => Format(markerTemplate, "new static") + name, (MemberAttributes.Override, _, _, _) => Format(markerTemplate, "override") + name, (MemberAttributes.Final | MemberAttributes.Override, _, _, _) => Format(markerTemplate,"override sealed") + name, (MemberAttributes.Final, true, _, _) => Format(markerTemplate, "new") + name, (MemberAttributes.Abstract, null, _, _) => Format(markerTemplate, "abstract") + name, (MemberAttributes.Abstract, true, _, _) => Format(markerTemplate, "new abstract") + name, (MemberAttributes.Const, _, _, _) => Format(markerTemplate, "abstract override") + name, (MemberAttributes.Final, null, true, false) => name, (_, null, true, false) => Format(markerTemplate, "virtual") + name, (_, true, true, false) => Format(markerTemplate, "new virtual") + name, _ => name }; } } }
mit
C#
ed90143e738f1181df2fcee1a1e2e164c6b596ef
Add `Point` animator.
wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,akrisiun/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia
src/Avalonia.Visuals/Animation/Animators/PointAnimator.cs
src/Avalonia.Visuals/Animation/Animators/PointAnimator.cs
using System; using Avalonia.Logging; using Avalonia.Media; namespace Avalonia.Animation.Animators { /// <summary> /// Animator that handles <see cref="Point"/> properties. /// </summary> public class PointAnimator : Animator<Point> { public override Point Interpolate(double progress, Point oldValue, Point newValue) { var deltaX = newValue.X - oldValue.Y; var deltaY = newValue.X - oldValue.Y; var nX = progress * deltaX + oldValue.X; var nY = progress * deltaY + oldValue.Y; return new Point(nX, nY); } } }
mit
C#
b3cf381c5d3b883be24df2db2b8210e38e8b348c
Add TestCaseHoldToQuit
NeoAdonis/osu,DrabWeb/osu,naoey/osu,johnneijzen/osu,ppy/osu,peppy/osu-new,johnneijzen/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,2yangk23/osu,ZLima12/osu,UselessToucan/osu,DrabWeb/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,ZLima12/osu,peppy/osu,NeoAdonis/osu,naoey/osu,smoogipoo/osu,naoey/osu,EVAST9919/osu,smoogipoo/osu,ppy/osu,EVAST9919/osu,NeoAdonis/osu,DrabWeb/osu
osu.Game.Tests/Visual/TestCaseHoldToQuit.cs
osu.Game.Tests/Visual/TestCaseHoldToQuit.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Play.HUD; namespace osu.Game.Tests.Visual { [Description("'Hold to Quit' UI element")] public class TestCaseHoldToQuit : OsuTestCase { private bool exitAction; public TestCaseHoldToQuit() { HoldToQuit holdToQuit; Add(holdToQuit = new HoldToQuit { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, }); holdToQuit.Button.ExitAction = () => exitAction = true; var text = holdToQuit.Children.OfType<SpriteText>().Single(); AddStep("Text fade in", () => { exitAction = false; holdToQuit.Button.TriggerOnMouseDown(); holdToQuit.Button.TriggerOnMouseUp(); }); AddUntilStep(() => text.IsPresent && !exitAction, "Text visible"); AddStep("Text fade out", () => { exitAction = false; holdToQuit.Button.TriggerOnMouseDown(); holdToQuit.Button.TriggerOnMouseUp(); }); AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible"); AddStep("Trigger exit action", () => { exitAction = false; holdToQuit.Button.TriggerOnMouseDown(); }); AddUntilStep(() => exitAction, $"{nameof(holdToQuit.Button.ExitAction)} was triggered"); } } }
mit
C#
37d7ef85798ebcf772d78ed003d1a615d15d0867
Add sandbox test (#10767)
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
Content.IntegrationTests/Tests/Utility/SandboxTest.cs
Content.IntegrationTests/Tests/Utility/SandboxTest.cs
using System.Threading.Tasks; using NUnit.Framework; namespace Content.IntegrationTests.Tests.Utility; public sealed class SandboxTest { [Test] public async Task Test() { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoServer = true}); var client = pairTracker.Pair.Client; await client.CheckSandboxed(typeof(Client.Entry.EntryPoint).Assembly); await pairTracker.CleanReturnAsync(); } }
mit
C#
0aa25a34e97be25596ae6235e214ef38fad0d496
Create function.cs
mmgrt/AIVision
TwitterMentionsMonitor/function.cs
TwitterMentionsMonitor/function.cs
using System; using Tweetinvi; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Net; using Tweetinvi.Parameters; using Tweetinvi.Models; public static async void Run(TimerInfo myTimer, TraceWriter log) { Tweetinvi.Auth.SetUserCredentials("Consumer Key", "Consumer Secret", "Access Token", "Access Token Secret"); log.Info("Perform search..."); var result = await Tweetinvi.SearchAsync.SearchTweets("#aivision OR #وصف"); log.Info("filtering results..."); DateTime requestedDateTime = DateTime.Now.Add(new TimeSpan(0, -3, 0)); result = result.Where(t => !Seen(t.Id.ToString()) && !t.IsRetweet && t.CreatedAt >= requestedDateTime).ToList<ITweet>(); log.Info("Check result count"); if (result.Count() != 0) { log.Info($"found: {result.Count().ToString()} tweets."); foreach (var tweet in result) { log.Info($"Tweet {tweet.Id.ToString()} discoverd!"); await new HttpClient().GetStringAsync("{AI Vision Core link}&tweet=" + tweet.Url); LogTweetRecord(tweet.Id.ToString()); } } else { log.Info("results: 0."); } log.Info("Finished."); } public static string logPath = System.Environment.GetEnvironmentVariable("HOME") + "tweets.log"; //public static string logPath = System.Environment.GetEnvironmentVariable("HOME") + "\\site\\wwwroot\\{YourFunctionName}\\" + "tweets.log"; public static bool Seen(string Id) { string log = File.ReadAllText(logPath); foreach (string tweet in log.Split('\n')) { if (tweet.Contains(Id)) { return true; } } return false; } public static void LogTweetRecord(string Id) { File.AppendAllText(logPath, "\nTweetId: " + Id); }
mit
C#
3a2e13be2265b5af07cdd533545b58ed2139f84c
Add missing file
SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia
src/Avalonia.Base/Media/TextFormatting/TextRunBounds.cs
src/Avalonia.Base/Media/TextFormatting/TextRunBounds.cs
namespace Avalonia.Media.TextFormatting { /// <summary> /// The bounding rectangle of text run /// </summary> public sealed class TextRunBounds { /// <summary> /// Constructing TextRunBounds /// </summary> internal TextRunBounds(Rect bounds, int firstCharacterIndex, int length, TextRun textRun) { Rectangle = bounds; TextSourceCharacterIndex = firstCharacterIndex; Length = length; TextRun = textRun; } /// <summary> /// First text source character index of text run /// </summary> public int TextSourceCharacterIndex { get; } /// <summary> /// character length of bounded text run /// </summary> public int Length { get; } /// <summary> /// Text run bounding rectangle /// </summary> public Rect Rectangle { get; } /// <summary> /// text run /// </summary> public TextRun TextRun { get; } } }
mit
C#
23a981d1a02229019e3367d68c27ce57de0568c7
fix broken build
assaframan/MoviesRestForAppHarbor,assaframan/MoviesRestForAppHarbor,ServiceStack/ServiceStack.Examples,ServiceStack/ServiceStack.Examples,zhaokunfay/ServiceStack.Examples,zhaokunfay/ServiceStack.Examples,ServiceStack/ServiceStack.Examples,assaframan/MoviesRestForAppHarbor,zhaokunfay/ServiceStack.Examples,ServiceStack/ServiceStack.Examples,zhaokunfay/ServiceStack.Examples
src/ServiceStack.Northwind/ServiceStack.Northwind.ServiceModel/Operations/Orders.cs
src/ServiceStack.Northwind/ServiceStack.Northwind.ServiceModel/Operations/Orders.cs
using System.Collections.Generic; using ServiceStack.Northwind.ServiceModel.Types; using ServiceStack.ServiceInterface.ServiceModel; public class Customers {} public class CustomerResponse : IHasResponseStatus { public CustomerResponse() { this.ResponseStatus = new ResponseStatus(); } public Customer Customer { get; set; } public ResponseStatus ResponseStatus { get; set; } } public class CustomersResponse : IHasResponseStatus { public CustomersResponse() { this.ResponseStatus = new ResponseStatus(); this.Customers = new List<Customer>(); } public List<Customer> Customers { get; set; } public ResponseStatus ResponseStatus { get; set; } } public class CustomerDetails { public string Id { get; set; } } public class CustomerDetailsResponse : IHasResponseStatus { public CustomerDetailsResponse() { this.ResponseStatus = new ResponseStatus(); this.CustomerOrders = new List<CustomerOrder>(); } public Customer Customer { get; set; } public List<CustomerOrder> CustomerOrders { get; set; } public ResponseStatus ResponseStatus { get; set; } } public class Orders { public int? Page { get; set; } public string CustomerId { get; set; } } public class OrdersResponse : IHasResponseStatus { public OrdersResponse() { this.ResponseStatus = new ResponseStatus(); this.Results = new List<CustomerOrder>(); } public List<CustomerOrder> Results { get; set; } public ResponseStatus ResponseStatus { get; set; } }
public class Customers {} public class CustomerResponse : IHasResponseStatus { public CustomerResponse() { this.ResponseStatus = new ResponseStatus(); } public Customer Customer { get; set; } public ResponseStatus ResponseStatus { get; set; } } public class CustomersResponse : IHasResponseStatus { public CustomersResponse() { this.ResponseStatus = new ResponseStatus(); this.Customers = new List<Customer>(); } public List<Customer> Customers { get; set; } public ResponseStatus ResponseStatus { get; set; } } public class CustomerDetails { public string Id { get; set; } } public class CustomerDetailsResponse : IHasResponseStatus { public CustomerDetailsResponse() { this.ResponseStatus = new ResponseStatus(); this.CustomerOrders = new List<CustomerOrder>(); } public Customer Customer { get; set; } public List<CustomerOrder> CustomerOrders { get; set; } public ResponseStatus ResponseStatus { get; set; } } public class Orders { public int? Page { get; set; } public string CustomerId { get; set; } } public class OrdersResponse : IHasResponseStatus { public OrdersResponse() { this.ResponseStatus = new ResponseStatus(); this.Results = new List<CustomerOrder>(); } public List<CustomerOrder> Results { get; set; } public ResponseStatus ResponseStatus { get; set; } }
bsd-3-clause
C#
618166f56d8596e5264fd1f1a81a0616d7b87b6a
Add test for CurrencyRatesService
Lc5/CurrencyRates,Lc5/CurrencyRates,Lc5/CurrencyRates
CurrencyRates.Tests/WebService/CurrencyRatesServiceTest.cs
CurrencyRates.Tests/WebService/CurrencyRatesServiceTest.cs
namespace CurrencyRates.Tests.WebService { using System.Linq; using CurrencyRates.Model; using CurrencyRates.Model.Entities; using CurrencyRates.Tests.TestUtils; using CurrencyRates.WebService; using Moq; using NUnit.Framework; [TestFixture] public class CurrencyRatesServiceTest { [Test] public void TestFind() { var context = new Mock<Context>(); var rates = new[] { new Rate { Id = 123, CurrencyCode = "EUR" } }; var contextRates = DbSetMockBuilder.Build(rates.AsQueryable()); contextRates.Setup(cr => cr.Include("File")).Returns(contextRates.Object); context.Setup(c => c.Rates).Returns(contextRates.Object); var currencyRatesService = new CurrencyRatesService(context.Object); var rate = currencyRatesService.Find(123); Assert.That(rate, Is.EqualTo(rates.First())); } [Test] public void TestFindLatest() { var context = new Mock<Context>(); var rates = new[] { new Rate { CurrencyCode = "EUR" }, new Rate { CurrencyCode = "USD" } }; var contextRates = DbSetMockBuilder.Build(rates.AsQueryable()); context.Setup(c => c.Rates).Returns(contextRates.Object); var currencyRatesService = new CurrencyRatesService(context.Object); var latestRates = currencyRatesService.FindLatest(); Assert.That(latestRates, Is.EqualTo(rates)); } } }
mit
C#
db3ed2172f80c51425394d822f5cdac8d4905a97
Create ServiceProviderFixture.cs
tiksn/TIKSN-Framework
TIKSN.Framework.IntegrationTests/ServiceProviderFixture.cs
TIKSN.Framework.IntegrationTests/ServiceProviderFixture.cs
using System; using System.Collections.Generic; using Autofac; using Autofac.Extensions.DependencyInjection; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using TIKSN.Data.Mongo; using TIKSN.Framework.IntegrationTests.Data.Mongo; namespace TIKSN.Framework.IntegrationTests { public class ServiceProviderFixture : IDisposable { private readonly IHost host; public ServiceProviderFixture() { host = Host.CreateDefaultBuilder() .ConfigureServices(services => { }) .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureContainer<ContainerBuilder>(builder => { builder.RegisterType<TestMongoRepository>().As<ITestMongoRepository>().InstancePerLifetimeScope(); builder.RegisterType<TestMongoDatabaseProvider>().As<IMongoDatabaseProvider>().SingleInstance(); }) .ConfigureHostConfiguration(builder => { builder.AddInMemoryCollection(GetInMemoryConfiguration()); }) .Build(); static Dictionary<string, string> GetInMemoryConfiguration() { return new() { {"ConnectionStrings:Mongo", "mongodb://root:0b6273775d@localhost:27017/TIKSN_Framework_IntegrationTests?authSource=admin"} }; } } public IServiceProvider Services => host.Services; public void Dispose() { host?.Dispose(); } } }
mit
C#
ffb64a3badb836004aab0f9d47c3f77e43093c0e
Add AccStructure
mehrandvd/Tralus,mehrandvd/Tralus
Selonia/Selonia.Accounting/Selonia.Accounting.BusinessModel/Entities/AccStructure.cs
Selonia/Selonia.Accounting/Selonia.Accounting.BusinessModel/Entities/AccStructure.cs
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using DevExpress.ExpressApp.Utils; using DevExpress.Persistent.Base.General; using Tralus.Framework.BusinessModel.Entities; namespace Selonia.Accounting.BusinessModel.Entities { public abstract class AccStructure : EntityBase, IHierarchyEntity { public string Code { get; set; } public string Name { get; set; } public string Description { get; set; } public abstract IHierarchyEntity Parent { get; set; } ITreeNode IHCategory.Parent { get { return Parent; } set { Parent = (IHierarchyEntity)value; } } ITreeNode ITreeNode.Parent => Parent; public abstract IBindingList Children { get; } public virtual Image GetImage(out string imageName) { imageName = "BO_Category"; return ImageLoader.Instance.GetImageInfo(imageName).Image; } } }
apache-2.0
C#
ace0d3830232812a722c2d2ca4d2d38cb85a0c3b
Create StringExtensions.cs
drawcode/labs-unity
extensions/StringExtensions.cs
extensions/StringExtensions.cs
using System; using System.Collections; using System.Globalization; using System.Text; using UnityEngine; public static class StringExtensions { public static string pathForBundleResource(string file) { var path = Application.dataPath.Replace("Data", ""); return PathUtil.Combine(path, file); } public static string pathForDocumentsResource(string file) { return PathUtil.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), file); } public static string ToHex(this int value) { return String.Format("{0:X}", value); } public static string ToHexPadded(this int value) { return String.Format("0x{0:X}", value); } public static int FromHex(string value) { // strip the leading 0x if (value.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) { value = value.Substring(2); } return Int32.Parse(value, NumberStyles.HexNumber); } public static string UnescapeXML(this string s) { if (string.IsNullOrEmpty(s)) return s; string returnString = s; returnString = returnString.Replace("&apos;", "'"); returnString = returnString.Replace("&quot;", "\""); returnString = returnString.Replace("&gt;", ">"); returnString = returnString.Replace("&lt;", "<"); returnString = returnString.Replace("&amp;", "&"); return returnString; } }
mit
C#
e6a5e7bf7ff470d3aa996d6f494791c5d445f610
add C_LOGIN_ARBITER
Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns
TCC.Core/Parsing/Messages/C_LOGIN_ARBITER.cs
TCC.Core/Parsing/Messages/C_LOGIN_ARBITER.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tera.Game; using Tera.Game.Messages; namespace TCC.Parsing.Messages { public class C_LOGIN_ARBITER : ParsedMessage { internal C_LOGIN_ARBITER(TeraMessageReader reader) : base(reader) { reader.Skip(15); //Language = (LangEnum)reader.ReadUInt32(); Version = reader.ReadInt32(); reader.Factory.ReleaseVersion = Version; } public int Version { get; set; } } }
mit
C#
630016ad2214dee85e4ef43de6b526d5292e0789
Add MonoNativeFunctionWrapperAttribute.
cwensley/maccore,mono/maccore,jorik041/maccore
src/MonoNativeFunctionWrapperAttribute.cs
src/MonoNativeFunctionWrapperAttribute.cs
// // MonoPInvokeCallbackAttribute.cs: necessary for AOT ports of Mono // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace MonoMac { [AttributeUsage (AttributeTargets.Delegate)] class MonoNativeFunctionWrapperAttribute : Attribute { } }
apache-2.0
C#
aa0e72cf8654bf5f0055abe3cd5626c9a81b0ef0
Add missing method
AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS
src/R/Editor/Test/Mocks/EditorTreeMock.cs
src/R/Editor/Test/Mocks/EditorTreeMock.cs
using System; using System.Diagnostics.CodeAnalysis; using Microsoft.R.Core.AST; using Microsoft.R.Editor.Tree; using Microsoft.R.Editor.Tree.Definitions; using Microsoft.VisualStudio.Text; namespace Microsoft.R.Editor.Test.Mocks { [ExcludeFromCodeCoverage] public sealed class EditorTreeMock : IEditorTree { public EditorTreeMock(ITextBuffer textBuffer, AstRoot ast) { TextBuffer = textBuffer; AstRoot = ast; } public AstRoot AstRoot { get; private set; } public bool IsReady { get { return true; } } public ITextBuffer TextBuffer { get; private set; } public ITextSnapshot TextSnapshot { get { return TextBuffer.CurrentSnapshot; } } public AstRoot AcquireReadLock(Guid treeUserId) { return AstRoot; } public int Invalidate() { return 1; } public void EnsureTreeReady() { } public bool ReleaseReadLock(Guid treeUserId) { return true; } #pragma warning disable 67 public event EventHandler<EventArgs> Closing; public event EventHandler<TreeNodesRemovedEventArgs> NodesRemoved; public event EventHandler<TreePositionsOnlyChangedEventArgs> PositionsOnlyChanged; public event EventHandler<EventArgs> UpdateBegin; public event EventHandler<TreeUpdatedEventArgs> UpdateCompleted; public event EventHandler<TreeUpdatePendingEventArgs> UpdatesPending; } }
using System; using System.Diagnostics.CodeAnalysis; using Microsoft.R.Core.AST; using Microsoft.R.Editor.Tree; using Microsoft.R.Editor.Tree.Definitions; using Microsoft.VisualStudio.Text; namespace Microsoft.R.Editor.Test.Mocks { [ExcludeFromCodeCoverage] public sealed class EditorTreeMock : IEditorTree { public EditorTreeMock(ITextBuffer textBuffer, AstRoot ast) { TextBuffer = textBuffer; AstRoot = ast; } public AstRoot AstRoot { get; private set; } public bool IsReady { get { return true; } } public ITextBuffer TextBuffer { get; private set; } public ITextSnapshot TextSnapshot { get { return TextBuffer.CurrentSnapshot; } } public AstRoot AcquireReadLock(Guid treeUserId) { return AstRoot; } public int Invalidate() { return 1; } public bool ReleaseReadLock(Guid treeUserId) { return true; } #pragma warning disable 67 public event EventHandler<EventArgs> Closing; public event EventHandler<TreeNodesRemovedEventArgs> NodesRemoved; public event EventHandler<TreePositionsOnlyChangedEventArgs> PositionsOnlyChanged; public event EventHandler<EventArgs> UpdateBegin; public event EventHandler<TreeUpdatedEventArgs> UpdateCompleted; public event EventHandler<TreeUpdatePendingEventArgs> UpdatesPending; } }
mit
C#
65f9a5fb3d0622d1d48a96201a3ee2c0e6b304fb
Add total number of gases atmospherics test (#1639)
space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content
Content.IntegrationTests/Tests/Atmos/ConstantsTest.cs
Content.IntegrationTests/Tests/Atmos/ConstantsTest.cs
using System; using System.Linq; using Content.Shared.Atmos; using NUnit.Framework; namespace Content.IntegrationTests.Tests.Atmos { [TestFixture] [TestOf(typeof(Atmospherics))] public class ConstantsTest : ContentIntegrationTest { [Test] public void TotalGasesTest() { var server = StartServerDummyTicker(); server.Post(() => { Assert.That(Atmospherics.Gases.Count(), Is.EqualTo(Atmospherics.TotalNumberOfGases)); Assert.That(Enum.GetValues(typeof(Gas)).Length, Is.EqualTo(Atmospherics.TotalNumberOfGases)); }); } } }
mit
C#
441c80a06f1f1aa95b625f093d1ee3e83491f7a3
Include ShareTarget.xaml.cs.
wangjun/windows-app,wangjun/windows-app
wallabag/wallabag.WindowsPhone/Views/ShareTarget.xaml.cs
wallabag/wallabag.WindowsPhone/Views/ShareTarget.xaml.cs
using System; using wallabag.Common; using Windows.ApplicationModel.Activation; using Windows.ApplicationModel.DataTransfer.ShareTarget; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; // Die Elementvorlage "Freigabezielvertrag" ist unter http://go.microsoft.com/fwlink/?LinkID=390556 dokumentiert. namespace wallabag.Views { /// <summary> /// Über diese Seite können andere Anwendungen Inhalte durch diese Anwendung freigeben. /// </summary> public sealed partial class ShareTarget : Page { /// <summary> /// Stellt einen Kanal zum Kommunizieren mit Windows über den Freigabevorgang bereit. /// </summary> private ShareOperation shareOperation; private ObservableDictionary defaultViewModel = new ObservableDictionary(); public ShareTarget() { this.InitializeComponent(); } public ObservableDictionary DefaultViewModel { get { return this.defaultViewModel; } } /// <summary> /// Wird aufgerufen, wenn eine andere Anwendung Inhalte durch diese Anwendung freigeben möchte. /// </summary> /// <param name="e">Aktivierungsdaten zum Koordinieren des Prozesses mit Windows.</param> public async void Activate(ShareTargetActivatedEventArgs e) { this.shareOperation = e.ShareOperation; // Metadaten über den freigegebenen Inhalt durch das Anzeigemodell kommunizieren var shareProperties = this.shareOperation.Data.Properties; this.DefaultViewModel["Title"] = shareProperties.Title; this.DefaultViewModel["Description"] = shareProperties.Description; this.DefaultViewModel["Sharing"] = false; this.DefaultViewModel["Url"] = await shareOperation.Data.GetWebLinkAsync(); Window.Current.Content = this; Window.Current.Activate(); } private string finalUrl() { string wallabagUrl = ApplicationSettings.GetSetting<string>("wallabagUrl", "", true); string encodedUrl = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(this.DefaultViewModel["Url"].ToString())); return string.Format("{0}?action=add&url={1}", wallabagUrl, encodedUrl); } /// <summary> /// Wird aufgerufen, wenn der Benutzer auf die Schaltfläche "Gemeinsam verwenden" klickt. /// </summary> /// <param name="sender">Instanz der Schaltfläche, die zum Initiieren der Freigabe verwendet wird.</param> /// <param name="e">Ereignisdaten, die beschreiben, wie auf die Schaltfläche geklickt wurde.</param> private void ShareButton_Click(object sender, RoutedEventArgs e) { this.DefaultViewModel["Sharing"] = true; this.webView.Navigate(new Uri(finalUrl())); // TODO: Aufgaben durchführen, die für Ihr Freigabeszenario geeignet sind, hierbei // this._shareOperation.Data verwenden. Üblicherweise werden hierbei zusätzliche Informationen // über individuelle Benutzeroberflächenelemente erfasst, die dieser Seite hinzugefügt wurden, z. B. // this.DefaultViewModel["Comment"] } private void Button_Click(object sender, RoutedEventArgs e) { this.shareOperation.ReportCompleted(); } } }
mit
C#
5e39bad3da46d7e04d9b6db788af1e479b63b276
Add cloudinary factory
Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife
PhotoLife/PhotoLife.Web/Factories/ICloudinaryFactory.cs
PhotoLife/PhotoLife.Web/Factories/ICloudinaryFactory.cs
using CloudinaryDotNet; namespace PhotoLife.Factories { public interface ICloudinaryFactory { Cloudinary GetCloudinary(); } }
mit
C#
682afb1a487e7703e2cd82627cdc4600bd65a476
Test for issue #1261 - .All() generates incomplete WHERE
linq2db/linq2db,MaceWindu/linq2db,LinqToDB4iSeries/linq2db,LinqToDB4iSeries/linq2db,MaceWindu/linq2db,linq2db/linq2db,ronnyek/linq2db
Tests/Linq/UserTests/Issue1261Tests.cs
Tests/Linq/UserTests/Issue1261Tests.cs
using System.Linq; using NUnit.Framework; namespace Tests.UserTests { [TestFixture, ActiveIssue] public class Issue1261Tests : TestBase { [Test, DataContextSource] public void TestLinqAll(string context) { using (var db = GetDataContext(context)) { var q = db.GrandChild.Where(x => x.ParentID == 1); var q1 = q.All(x => x.ChildID == 11 && x.GrandChildID == 777); var q2 = q.All(x => x.GrandChildID == 777 && x.ChildID == 11); Assert.AreEqual(q1, q2); } } } }
mit
C#
3e3c53a97bb95bf85a370033847b58455579b4fa
Add basic unit test for SecurityProtocolManager
ViveportSoftware/vita_core_csharp,ViveportSoftware/vita_core_csharp
source/Htc.Vita.Core.Tests/SecurityProtocolManagerTest.cs
source/Htc.Vita.Core.Tests/SecurityProtocolManagerTest.cs
using Htc.Vita.Core.Net; using Xunit; using Xunit.Abstractions; namespace Htc.Vita.Core.Tests { public class SecurityProtocolManagerTest { private readonly ITestOutputHelper _output; public SecurityProtocolManagerTest(ITestOutputHelper output) { _output = output; } [Fact] public void Default_0_GetAvailableProtocol() { var availableProtocol = SecurityProtocolManager.GetAvailableProtocol(); Assert.NotEqual(0, (int) availableProtocol); _output.WriteLine($@"availableProtocol: {availableProtocol}"); } } }
mit
C#
38249f9cc9371da1db7c26b1b62cd62daa8ffb3f
add tests for adding a social media link
mzrimsek/resume-site-api
Test.Integration/ControllerTests/SocialMediaLinksControllerTests/AddSocialMediaLinkShould.cs
Test.Integration/ControllerTests/SocialMediaLinksControllerTests/AddSocialMediaLinkShould.cs
using System.Net; using System.Net.Http; using FluentAssertions; using Microsoft.AspNetCore.TestHost; using Microsoft.VisualStudio.TestTools.UnitTesting; using Test.Integration.TestHelpers; using Test.Integration.TestModels.SocialMediaLinkModels; namespace Test.Integration.ControllerTests.SocialMediaLinksControllerTests { [TestClass] public class AddSocialMediaLinkShould { private TestServer _server; private HttpClient _client; private int _socialMediaLinkId; [TestInitialize] public void SetUp() { (_server, _client) = new TestSetupHelper().GetTestServerAndClient(); } [TestCleanup] public void TearDown() { var _ = _client.DeleteAsync($"{ControllerRouteEnum.SocialMediaLinks}/{_socialMediaLinkId}").Result; _client.Dispose(); _server.Dispose(); } [TestMethod] public void ReturnStatusCodeCreated_WhenGivenValidModel() { var model = TestObjectGetter.GetAddSocialMediaLinkViewModel(); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PostAsync($"{ControllerRouteEnum.SocialMediaLinks}", requestContent).Result; _socialMediaLinkId = RequestHelper.GetObjectFromResponseContent<SocialMediaLinkViewModel>(response).Id; response.StatusCode.Should().Be(HttpStatusCode.Created); } [TestMethod] public void ReturnStatusCodeBadRequest_WhenGivenInvalidModel() { var model = TestObjectGetter.GetAddSocialMediaLinkViewModel(null); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PostAsync($"{ControllerRouteEnum.SocialMediaLinks}", requestContent).Result; response.StatusCode.Should().Be(HttpStatusCode.BadRequest); } [TestMethod] public void ReturnCorrectViewModel() { var model = TestObjectGetter.GetAddSocialMediaLinkViewModel(); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PostAsync($"{ControllerRouteEnum.SocialMediaLinks}", requestContent).Result; var serializedContent = RequestHelper.GetObjectFromResponseContent<SocialMediaLinkViewModel>(response); _socialMediaLinkId = serializedContent.Id; var isCorrectViewModel = AssertHelper.AreTestSocialMediaLinkViewModelsEqual(model, serializedContent); isCorrectViewModel.Should().BeTrue(); } [TestMethod] public void SaveCorrectViewModel() { var model = TestObjectGetter.GetAddSocialMediaLinkViewModel(); var requestContent = RequestHelper.GetRequestContentFromObject(model); var response = _client.PostAsync($"{ControllerRouteEnum.SocialMediaLinks}", requestContent).Result; _socialMediaLinkId = RequestHelper.GetObjectFromResponseContent<SocialMediaLinkViewModel>(response).Id; response = _client.GetAsync($"{ControllerRouteEnum.SocialMediaLinks}/{_socialMediaLinkId}").Result; var serializedContent = RequestHelper.GetObjectFromResponseContent<SocialMediaLinkViewModel>(response); var isCorrectViewModel = AssertHelper.AreTestSocialMediaLinkViewModelsEqual(model, serializedContent); isCorrectViewModel.Should().BeTrue(); } } }
mit
C#
68a043a0703202fc918e5879cc6eef296b14f7eb
Add test case covering regression
UselessToucan/osu,peppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu
osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs
osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Mods; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Objects; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests.Mods { public class TestSceneCatchModRelax : ModTestScene { protected override Ruleset CreatePlayerRuleset() => new CatchRuleset(); [Test] public void TestModRelax() => CreateModTest(new ModTestData { Mod = new CatchModRelax(), Autoplay = false, PassCondition = () => { var playfield = this.ChildrenOfType<CatchPlayfield>().Single(); InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre); return Player.ScoreProcessor.Combo.Value > 0; }, Beatmap = new Beatmap { HitObjects = new List<HitObject> { new Fruit { X = CatchPlayfield.CENTER_X } } } }); } }
mit
C#
8a56c26cec0d43892f289e6313908dfed23e3e07
Apply permutation
Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews
CareerCup/Facebook/reorder_array.cs
CareerCup/Facebook/reorder_array.cs
// http://careercup.com/question?id=5756151524229120 // // Given an array A and an array of indexes B, reorder // objects in A. // // a = { "c", "d", "e", "f", "g"] // b = { 3, 0, 4, 1, 2 ] // // result : = ["d", "f", "g", "c", "e"] // using System; using System.Linq; static class Program { static char[] Permute(this char[] a, int[] permutation) { for (int i = 0; i < a.Length; i++) { int position = i; char current = a[i]; while (permutation[position] >= 0) { char next = a[permutation[position]]; int nextPosition = permutation[position]; a[permutation[position]] = current; permutation[position] = -1; position = nextPosition; current = next; } } return a; } static void Main() { if (!new [] { 'c', 'd', 'e', 'f', 'g' }. Permute(new [] { 3, 0, 4, 1, 2 }). SequenceEqual(new [] { 'd' , 'f', 'g', 'c', 'e' })) { throw new Exception(String.Format("You're not good enough {0}", String.Join(", ", new [] { 'c', 'd', 'e', 'f', 'g' }.Permute(new [] { 3, 0, 4, 1, 2 })))); } Console.WriteLine("All appears to be well"); } }
mit
C#
09a984d474a514128f8134d41db9db2a71f8b0aa
Add Tuples.cs
devlights/try-csharp
TryCSharp.Samples/CSharp7/Tuples.cs
TryCSharp.Samples/CSharp7/Tuples.cs
using System; using System.Threading; using TryCSharp.Common; namespace TryCSharp.Samples.CSharp7 { /// <summary> /// C# 7 の新機能についてのサンプルです。 /// </summary> /// <remarks> /// Tuples について /// https://docs.microsoft.com/ja-jp/dotnet/csharp/whats-new/csharp-7#tuples /// https://ufcpp.net/study/csharp/cheatsheet/ap_ver7/#tuple /// </remarks> [Sample] public class Tuples : IExecutable { public void Execute() { // ---------------------------------------------------------------- // タプル // // C# 7 から python や Go のように タプル がサポートされるようになった。 // 元々、System.Tuple という型で存在していたのだが、それが言語として // サポートされるようになった感じ。内部的には ValueTask として表現される。 // // 前までは // Tuple<int, int> t = Tuple.Create(10, 11) // としていた部分を // var (x, y) = (10, 11); // とかけるようになっている。 // // この記述は メソッドの引数でも戻り値にも利用できる。 // // 基本 Python などの言語やっている人には馴染みやすい形となった。 // ---------------------------------------------------------------- var oldStyle = Tuple.Create(10, 11); // Tuple<int, int> var newStyle = (10, 11); // ValueTuple<int, int> Output.WriteLine($"[old] {oldStyle.GetType().Name}"); Output.WriteLine($"[new] {newStyle.GetType().Name}"); // C# 7 の別の新機能 Deconstruct (分解) を利用して以下のようにもかける var (x, y) = (10, 11); Output.WriteLine($"[x] {x}\t[y] {y}"); // メソッドの引数にも戻り値にも利用できる (Thread, int) GetThreadInfo() { var t = Thread.CurrentThread; return (t, t.ManagedThreadId); } var (_, id) = GetThreadInfo(); // 不要な情報がある場合は Go のように アンダースコア で捨てる Output.WriteLine($"[main] threadId: {id}"); } } }
mit
C#
2cb7f2f793d992bc00fb919a4e6873d934129fbb
add IStatementDescription
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Crypto/ZeroKnowledge/IStatementDescription.cs
WalletWasabi/Crypto/ZeroKnowledge/IStatementDescription.cs
using System.Collections.Generic; using WalletWasabi.Crypto.Groups; namespace WalletWasabi.Crypto.ZeroKnowledge { public interface IStatementDescription { IEnumerable<GroupElement> PublicPoints { get; } IEnumerable<GroupElement> Generators { get; } } }
mit
C#
0f016c90e933175fe7a231e5525b4233de880972
Create CommentsController
DimitarDKirov/Forum-Paulo-Coelho,DimitarDKirov/Forum-Paulo-Coelho,DimitarDKirov/Forum-Paulo-Coelho
Forum-Paulo-Coelho/ForumSystem.Api/Controllers/CommentsController.cs
Forum-Paulo-Coelho/ForumSystem.Api/Controllers/CommentsController.cs
namespace ForumSystem.Api.Controllers { using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using Microsoft.AspNet.Identity; using ForumSystem.Api.Models; using ForumSystem.Data; using ForumSystem.Models; public class CommentsController : BaseApiController { public CommentsController(IForumDbContext data) : base(data) { } [HttpPost] [Authorize] public IHttpActionResult Create(int id, CommentDataModel model) { var userID = this.User.Identity.GetUserId(); var comment = new Comment { PostId = id, UserId = userID, Content = model.Content, CommentDate = DateTime.Now }; this.data.Comments.Add(comment); this.data.SaveChanges(); return Ok(); } } }
mit
C#
23608a49b863533042fdd125da25c5ceff363ebe
Remove attribute since this is no longer a test code
karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS
src/Common/Wpf/Impl/Extensions/VisualTreeExtensions.cs
src/Common/Wpf/Impl/Extensions/VisualTreeExtensions.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System.Diagnostics.CodeAnalysis; using System.Windows; using System.Windows.Media; namespace Microsoft.Common.Wpf.Extensions { public static class VisualTreeExtensions { public static T FindChild<T>(DependencyObject o) where T : DependencyObject { if (o is T) { return o as T; } int childrenCount = VisualTreeHelper.GetChildrenCount(o); for (int i = 0; i < childrenCount; i++) { var child = VisualTreeHelper.GetChild(o, i); var inner = FindChild<T>(child); if (inner != null) { return inner; } } return null; } public static T FindNextSibling<T>(DependencyObject o) where T : DependencyObject { var parent = VisualTreeHelper.GetParent(o); int childrenCount = VisualTreeHelper.GetChildrenCount(parent); int i = 0; for (; i < childrenCount; i++) { var child = VisualTreeHelper.GetChild(parent, i); if (child == o) { break; } } i++; for (; i < childrenCount; i++) { var child = VisualTreeHelper.GetChild(parent, i); if (child is T) { return child as T; } } return null; } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System.Diagnostics.CodeAnalysis; using System.Windows; using System.Windows.Media; namespace Microsoft.Common.Wpf.Extensions { [ExcludeFromCodeCoverage] public static class VisualTreeExtensions { public static T FindChild<T>(DependencyObject o) where T : DependencyObject { if (o is T) { return o as T; } int childrenCount = VisualTreeHelper.GetChildrenCount(o); for (int i = 0; i < childrenCount; i++) { var child = VisualTreeHelper.GetChild(o, i); var inner = FindChild<T>(child); if (inner != null) { return inner; } } return null; } public static T FindNextSibling<T>(DependencyObject o) where T : DependencyObject { var parent = VisualTreeHelper.GetParent(o); int childrenCount = VisualTreeHelper.GetChildrenCount(parent); int i = 0; for (; i < childrenCount; i++) { var child = VisualTreeHelper.GetChild(parent, i); if (child == o) { break; } } i++; for (; i < childrenCount; i++) { var child = VisualTreeHelper.GetChild(parent, i); if (child is T) { return child as T; } } return null; } } }
mit
C#
79ea6a4e380b74ac688ff8a7e98bab66ee12b491
Add PolyLineSegment path segment
SuperJMN/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,wieslawsoltes/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia
src/Avalonia.Visuals/Media/PolyLineSegment.cs
src/Avalonia.Visuals/Media/PolyLineSegment.cs
using System.Collections.Generic; using Avalonia.Collections; namespace Avalonia.Media { /// <summary> /// Represents a set of line segments defined by a points collection with each Point specifying the end point of a line segment. /// </summary> public sealed class PolyLineSegment : PathSegment { /// <summary> /// Defines the <see cref="Points"/> property. /// </summary> public static readonly StyledProperty<Points> PointsProperty = AvaloniaProperty.Register<PolyLineSegment, Points>(nameof(Points)); /// <summary> /// Gets or sets the points. /// </summary> /// <value> /// The points. /// </value> public AvaloniaList<Point> Points { get => GetValue(PointsProperty); set => SetValue(PointsProperty, value); } /// <summary> /// Initializes a new instance of the <see cref="PolyLineSegment"/> class. /// </summary> public PolyLineSegment() { Points = new Points(); } /// <summary> /// Initializes a new instance of the <see cref="PolyLineSegment"/> class. /// </summary> /// <param name="points">The points.</param> public PolyLineSegment(IEnumerable<Point> points) : this() { Points.AddRange(points); } protected internal override void ApplyTo(StreamGeometryContext ctx) { var points = Points; if (points.Count > 0) { for (int i = 0; i < points.Count; i++) { ctx.LineTo(points[i]); } } } public override string ToString() => Points.Count >= 1 ? "L " + string.Join(" ", Points) : ""; } }
mit
C#
e79988c2f120cdd21d5f3bd4249a6455e1854f95
Add skeleton BYOND implementation
tgstation/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server-tools,Cyberboss/tgstation-server
src/Tgstation.Server.Host/Components/Byond.cs
src/Tgstation.Server.Host/Components/Byond.cs
using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Host.IO; namespace Tgstation.Server.Host.Components { /// <inheritdoc /> sealed class Byond : IByond { /// <summary> /// The <see cref="IIOManager"/> for <see cref="Byond"/> /// </summary> readonly IIOManager ioManager; /// <summary> /// The <see cref="ILogger"/> for <see cref="Byond"/> /// </summary> readonly ILogger<Byond> logger; /// <summary> /// List of installed BYOND <see cref="Version"/>s /// </summary> readonly List<Version> installedVersions; /// <summary> /// Construct <see cref="Byond"/> /// </summary> /// <param name="ioManager">The value of <see cref="ioManager"/></param> /// <param name="logger">The value of <see cref="logger"/></param> public Byond(IIOManager ioManager, ILogger<Byond> logger) { this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); } /// <inheritdoc /> public Task ChangeVersion(Version version, CancellationToken cancellationToken) { throw new NotImplementedException(); } /// <inheritdoc /> public Task ClearCache(CancellationToken cancellationToken) { throw new NotImplementedException(); } /// <inheritdoc /> public Task<Version> GetVersion(CancellationToken cancellationToken) { throw new NotImplementedException(); } /// <inheritdoc /> public IByondExecutableLock UseExecutables(Version requiredVersion) { throw new NotImplementedException(); } } }
agpl-3.0
C#
65aa01866ee8fb6d14ef78ce3873e7bbad4692a8
add test scene for OsuMarkdownContainer
peppy/osu,peppy/osu-new,NeoAdonis/osu,peppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,ppy/osu
osu.Game.Tests/Visual/UserInterface/TestSceneOsuMarkdownContainer.cs
osu.Game.Tests/Visual/UserInterface/TestSceneOsuMarkdownContainer.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers.Markdown; using osu.Game.Overlays; namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneOsuMarkdownContainer : OsuTestScene { private OsuMarkdownContainer markdownContainer; [Cached] private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Orange); [SetUp] public void Setup() => Schedule(() => { Children = new Drawable[] { new Box { Colour = overlayColour.Background5, RelativeSizeAxes = Axes.Both, }, new BasicScrollContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(20), Child = markdownContainer = new OsuMarkdownContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y } } }; }); [Test] public void TestLink() { AddStep("Add Link", () => { markdownContainer.Text = "[Welcome to osu!](https://osu.ppy.sh)"; }); } } }
mit
C#
6c6d2972feec658d804cb6d70d0ee7713ea335cc
Fix incorrect title on edit page
aaronamm/Orchard,yersans/Orchard,Serlead/Orchard,gcsuk/Orchard,LaserSrl/Orchard,jimasp/Orchard,aaronamm/Orchard,Dolphinsimon/Orchard,OrchardCMS/Orchard,yersans/Orchard,Serlead/Orchard,LaserSrl/Orchard,Dolphinsimon/Orchard,AdvantageCS/Orchard,fassetar/Orchard,Lombiq/Orchard,jersiovic/Orchard,omidnasri/Orchard,IDeliverable/Orchard,OrchardCMS/Orchard,bedegaming-aleksej/Orchard,Serlead/Orchard,IDeliverable/Orchard,jimasp/Orchard,bedegaming-aleksej/Orchard,hbulzy/Orchard,ehe888/Orchard,hbulzy/Orchard,Dolphinsimon/Orchard,Fogolan/OrchardForWork,LaserSrl/Orchard,IDeliverable/Orchard,Lombiq/Orchard,bedegaming-aleksej/Orchard,omidnasri/Orchard,jimasp/Orchard,rtpHarry/Orchard,jersiovic/Orchard,omidnasri/Orchard,bedegaming-aleksej/Orchard,omidnasri/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,ehe888/Orchard,hbulzy/Orchard,aaronamm/Orchard,fassetar/Orchard,Fogolan/OrchardForWork,bedegaming-aleksej/Orchard,jimasp/Orchard,AdvantageCS/Orchard,Serlead/Orchard,LaserSrl/Orchard,hbulzy/Orchard,LaserSrl/Orchard,fassetar/Orchard,rtpHarry/Orchard,gcsuk/Orchard,Fogolan/OrchardForWork,hbulzy/Orchard,rtpHarry/Orchard,rtpHarry/Orchard,omidnasri/Orchard,gcsuk/Orchard,yersans/Orchard,ehe888/Orchard,gcsuk/Orchard,AdvantageCS/Orchard,jersiovic/Orchard,OrchardCMS/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,omidnasri/Orchard,Fogolan/OrchardForWork,fassetar/Orchard,Serlead/Orchard,IDeliverable/Orchard,yersans/Orchard,yersans/Orchard,jersiovic/Orchard,ehe888/Orchard,Fogolan/OrchardForWork,OrchardCMS/Orchard,AdvantageCS/Orchard,jersiovic/Orchard,ehe888/Orchard,aaronamm/Orchard,AdvantageCS/Orchard,Lombiq/Orchard,IDeliverable/Orchard,Lombiq/Orchard,OrchardCMS/Orchard,Lombiq/Orchard,omidnasri/Orchard,jimasp/Orchard,fassetar/Orchard,gcsuk/Orchard,rtpHarry/Orchard,aaronamm/Orchard
src/Orchard.Web/Modules/Orchard.Blogs/Views/Content-Blog.Edit.cshtml
src/Orchard.Web/Modules/Orchard.Blogs/Views/Content-Blog.Edit.cshtml
@using Orchard.Mvc.Html; <div class="edit-item"> <div class="edit-item-primary"> @if (Model.Content != null) { <div class="edit-item-content"> @Display(Model.Content) </div> } </div> <div class="edit-item-secondary group"> @if (Model.Actions != null) { <div class="edit-item-actions"> @Display(Model.Actions) </div> } @if (Model.Sidebar != null) { <div class="edit-item-sidebar group"> @Display(Model.Sidebar) </div> } </div> </div>
@using Orchard.Mvc.Html; @{ Layout.Title = T("New Blog"); } <div class="edit-item"> <div class="edit-item-primary"> @if (Model.Content != null) { <div class="edit-item-content"> @Display(Model.Content) </div> } </div> <div class="edit-item-secondary group"> @if (Model.Actions != null) { <div class="edit-item-actions"> @Display(Model.Actions) </div> } @if (Model.Sidebar != null) { <div class="edit-item-sidebar group"> @Display(Model.Sidebar) </div> } </div> </div>
bsd-3-clause
C#
58fb4c6bb9211ce8e206fc50267775edde2c59a8
Remove unnecessary Task.Run.
karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS
src/Package/Impl/ProjectSystem/PropertyPages/PropertyPageProvider.cs
src/Package/Impl/ProjectSystem/PropertyPages/PropertyPageProvider.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System.Linq; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.ProjectSystem.Utilities; using Microsoft.VisualStudio.ProjectSystem.VS; namespace Microsoft.VisualStudio.R.Package.ProjectSystem.PropertyPages { [AppliesTo("RTools")] [Export(typeof(IVsProjectDesignerPageProvider))] internal class PropertyPageProvider : IVsProjectDesignerPageProvider { [ImportMany] private OrderPrecedenceImportCollection<IPageMetadata> PropertyPages { get; set; } [ImportingConstructor] public PropertyPageProvider(UnconfiguredProject unconfiguredProject) { PropertyPages = new OrderPrecedenceImportCollection<IPageMetadata>(projectCapabilityCheckProvider: unconfiguredProject); } public Task<IReadOnlyCollection<IPageMetadata>> GetPagesAsync() { return Task.FromResult((IReadOnlyCollection<IPageMetadata>)PropertyPages.Select(p => p.Value).ToList().AsReadOnly()); } // Only here to ensure one instance per project [Import] [ExcludeFromCodeCoverage] internal UnconfiguredProject UnconfiguredProject { get; private set; } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System.Linq; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.ProjectSystem.Utilities; using Microsoft.VisualStudio.ProjectSystem.VS; namespace Microsoft.VisualStudio.R.Package.ProjectSystem.PropertyPages { [AppliesTo("RTools")] [Export(typeof(IVsProjectDesignerPageProvider))] internal class PropertyPageProvider : IVsProjectDesignerPageProvider { [ImportMany] private OrderPrecedenceImportCollection<IPageMetadata> PropertyPages { get; set; } [ImportingConstructor] public PropertyPageProvider(UnconfiguredProject unconfiguredProject) { PropertyPages = new OrderPrecedenceImportCollection<IPageMetadata>(projectCapabilityCheckProvider: unconfiguredProject); } public Task<IReadOnlyCollection<IPageMetadata>> GetPagesAsync() { return Task.Run<IReadOnlyCollection<IPageMetadata>>( () => PropertyPages.Select(p => p.Value).ToList().AsReadOnly() ); } // Only here to ensure one instance per project [Import] [ExcludeFromCodeCoverage] internal UnconfiguredProject UnconfiguredProject { get; private set; } } }
mit
C#
c7faf326e80d28fcefa73d02ec1b800f9aedd250
Create Message Context Factory interface
HelloKitty/GladNet2-Lidgren,HelloKitty/GladNet2.0,HelloKitty/GladNet2-Lidgren,HelloKitty/GladNet2,HelloKitty/GladNet2,HelloKitty/GladNet2.0
src/GladNet.Lidgren.Engine.Common/Network/Message/ContextMessages/ILidgrenMessageContextFactory.cs
src/GladNet.Lidgren.Engine.Common/Network/Message/ContextMessages/ILidgrenMessageContextFactory.cs
using Lidgren.Network; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GladNet.Lidgren.Engine.Common { /// <summary> /// Factory that generates <see cref="LidgrenMessageContext"/>s. /// </summary> public interface ILidgrenMessageContextFactory { /// <summary> /// Indicates if the <see cref="NetIncomingMessageType"/> is a context /// the factory can create. /// </summary> /// <param name="messageType">The message type.</param> /// <returns>True if the context factory can produce a context for that type.</returns> bool CanCreateContext(NetIncomingMessageType messageType); /// <summary> /// Creates a <see cref="LidgrenMessageContext"/> based on the incoming /// <see cref="NetIncomingMessage"/> instance. /// </summary> /// <param name="message"></param> /// <returns>A non-null reference to a derived <see cref="LidgrenMessageContext"/>.</returns> LidgrenMessageContext CreateContext(NetIncomingMessage message); } }
bsd-3-clause
C#
6c0da5856fba1806a47549704e0fc85240d9dcee
Update server side API for single multiple answer question
Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist
Trappist/src/Promact.Trappist.Core/Controllers/QuestionsController.cs
Trappist/src/Promact.Trappist.Core/Controllers/QuestionsController.cs
using Microsoft.AspNetCore.Mvc; using Promact.Trappist.DomainModel.Models.Question; using Promact.Trappist.Repository.Questions; using System; namespace Promact.Trappist.Core.Controllers { [Route("api/question")] public class QuestionsController : Controller { private readonly IQuestionRepository _questionsRepository; public QuestionsController(IQuestionRepository questionsRepository) { _questionsRepository = questionsRepository; } [HttpGet] /// <summary> /// Gets all questions /// </summary> /// <returns>Questions list</returns> public IActionResult GetQuestions() { var questions = _questionsRepository.GetAllQuestions(); return Json(questions); } [HttpPost] /// <summary> /// Add single multiple answer question into SingleMultipleAnswerQuestion model /// </summary> /// <param name="singleMultipleAnswerQuestion"></param> /// <returns></returns> public IActionResult AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion) { _questionsRepository.AddSingleMultipleAnswerQuestion(singleMultipleAnswerQuestion); return Ok(); } /// <summary> /// Add options of single multiple answer question to SingleMultipleAnswerQuestionOption model /// </summary> /// <param name="singleMultipleAnswerQuestionOption"></param> /// <returns></returns> public IActionResult AddSingleMultipleAnswerQuestionOption(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption) { _questionsRepository.AddSingleMultipleAnswerQuestionOption(singleMultipleAnswerQuestionOption); return Ok(); } } }
mit
C#
9ad14311abe5ff5a93bfe7423cee3ae051967d4e
Create EditStatCommand.cs
NinjaVault/NinjaHive,NinjaVault/NinjaHive
NinjaHive.Contract/Commands/EditStatCommand.cs
NinjaHive.Contract/Commands/EditStatCommand.cs
using System.ComponentModel.DataAnnotations; using NinjaHive.Contract.DTOs; using NinjaHive.Core.Validations; namespace NinjaHive.Contract.Commands { public class EditStatCommand { public EditStatCommand(StatInfo stat, bool createNew) { this.Stat = stat; this.CreateNew = createNew; } [Required] [ValidateObject] public StatInfo Stat { get; set; } public bool CreateNew { get; set; } } }
apache-2.0
C#
066832243fd886e4f3148b2685f78bbb54b1186f
Add base class for auth tests.
rnwood/smtp4dev,rnwood/smtp4dev,rnwood/smtp4dev,rnwood/smtp4dev
Rnwood.SmtpServer.Tests/Extensions/Auth/AuthMechanismTest.cs
Rnwood.SmtpServer.Tests/Extensions/Auth/AuthMechanismTest.cs
using System; using System.Text; namespace Rnwood.SmtpServer.Tests.Extensions.Auth { public class AuthMechanismTest { protected static bool VerifyBase64Response(string base64, string expectedString) { string decodedString = Encoding.ASCII.GetString(Convert.FromBase64String(base64)); return decodedString.Equals(expectedString); } protected static string EncodeBase64(string asciiString) { return Convert.ToBase64String(Encoding.ASCII.GetBytes(asciiString)); } } }
bsd-3-clause
C#
cb0546c4dd685ad33e876fbea52af5c7c20492ab
Add benchmark for ElementMetadata.Create (#764)
tomjebo/Open-XML-SDK,ThomasBarnekow/Open-XML-SDK,OfficeDev/Open-XML-SDK
test/DocumentFormat.OpenXml.Benchmarks/ElementMetadataTests.cs
test/DocumentFormat.OpenXml.Benchmarks/ElementMetadataTests.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using BenchmarkDotNet.Attributes; using DocumentFormat.OpenXml.Framework.Metadata; namespace DocumentFormat.OpenXml.Benchmarks { public class ElementMetadataTests { [GlobalSetup] public void Setup() { _element = new AlternateContent(); } [Benchmark] public object CreateWithInstance() { object o = ElementMetadata.Create(_element); return o; // return the object to make the release build do not optimize it } [Benchmark] public object CreateWithGeneric() { object o = ElementMetadata.Create<AlternateContent>(); return o; // return the object to make the release build do not optimize it } private OpenXmlElement _element; } }
mit
C#
838ffe4e834e1ecf54f711cd6a1b6656c3d0cb00
Restructure TypeHint (constructors/properties at top of file
KevinRansom/roslyn,tannergooding/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,bartdesmet/roslyn,tannergooding/roslyn,physhi/roslyn,physhi/roslyn,bartdesmet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,tmat/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,physhi/roslyn,diryboy/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,eriawan/roslyn,eriawan/roslyn,AmadeusW/roslyn,tmat/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,mavasani/roslyn,eriawan/roslyn,tannergooding/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,KevinRansom/roslyn,AmadeusW/roslyn,sharwell/roslyn,AlekseyTs/roslyn,AmadeusW/roslyn,tmat/roslyn,AlekseyTs/roslyn,sharwell/roslyn,KevinRansom/roslyn,diryboy/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,ErikSchierboom/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,mgoertz-msft/roslyn,sharwell/roslyn
src/Features/Core/Portable/InlineHints/TypeHint.cs
src/Features/Core/Portable/InlineHints/TypeHint.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Diagnostics; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.InlineHints { internal readonly struct TypeHint { public TypeHint(ITypeSymbol type, TextSpan span, bool leadingSpace = false, bool trailingSpace = false) : this(type, span, prefix: CreateSpaceSymbolPartArray(leadingSpace), suffix: CreateSpaceSymbolPartArray(trailingSpace)) { } private TypeHint(ITypeSymbol type, TextSpan span, ImmutableArray<SymbolDisplayPart> prefix, ImmutableArray<SymbolDisplayPart> suffix) { Type = type; Span = span; Prefix = prefix; Suffix = suffix; } public ITypeSymbol Type { get; } public TextSpan Span { get; } public ImmutableArray<SymbolDisplayPart> Prefix { get; } public ImmutableArray<SymbolDisplayPart> Suffix { get; } private static ImmutableArray<SymbolDisplayPart> CreateSpaceSymbolPartArray(bool hasSpace) => hasSpace ? ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Space, symbol: null, " ")) : ImmutableArray<SymbolDisplayPart>.Empty; public void Deconstruct(out ITypeSymbol type, out TextSpan span, out ImmutableArray<SymbolDisplayPart> prefix, out ImmutableArray<SymbolDisplayPart> suffix) { type = Type; span = Span; prefix = Prefix; suffix = Suffix; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Diagnostics; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.InlineHints { internal readonly struct TypeHint { public TypeHint(ITypeSymbol type, TextSpan span, bool leadingSpace = false, bool trailingSpace = false) : this(type, span, prefix: CreateSpaceSymbolPartArray(leadingSpace), suffix: CreateSpaceSymbolPartArray(trailingSpace)) { } private static ImmutableArray<SymbolDisplayPart> CreateSpaceSymbolPartArray(bool hasSpace) => hasSpace ? ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Space, symbol: null, " ")) : ImmutableArray<SymbolDisplayPart>.Empty; private TypeHint(ITypeSymbol type, TextSpan span, ImmutableArray<SymbolDisplayPart> prefix, ImmutableArray<SymbolDisplayPart> suffix) { Type = type; Span = span; Prefix = prefix; Suffix = suffix; } public ITypeSymbol Type { get; } public TextSpan Span { get; } public ImmutableArray<SymbolDisplayPart> Prefix { get; } public ImmutableArray<SymbolDisplayPart> Suffix { get; } public void Deconstruct(out ITypeSymbol type, out TextSpan span, out ImmutableArray<SymbolDisplayPart> prefix, out ImmutableArray<SymbolDisplayPart> suffix) { type = Type; span = Span; prefix = Prefix; suffix = Suffix; } } }
mit
C#
09e4e8e7a9414c489959b0f9fdbbb8243d043f90
Check in a file I forgot from the ResourceManager change
tijoytom/corert,gregkalapos/corert,sandreenko/corert,botaberg/corert,sandreenko/corert,shrah/corert,yizhang82/corert,shrah/corert,botaberg/corert,sandreenko/corert,gregkalapos/corert,krytarowski/corert,yizhang82/corert,krytarowski/corert,botaberg/corert,shrah/corert,krytarowski/corert,shrah/corert,gregkalapos/corert,sandreenko/corert,krytarowski/corert,tijoytom/corert,tijoytom/corert,tijoytom/corert,botaberg/corert,yizhang82/corert,yizhang82/corert,gregkalapos/corert
src/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/HasEmbeddedStringResourcesAttribute.cs
src/System.Private.CoreLib/src/Internal/Runtime/CompilerServices/HasEmbeddedStringResourcesAttribute.cs
using System; namespace Internal.Runtime.CompilerServices { /// <summary> /// Applied by the compiler to assemblies that contain embedded string resources. /// In UWP apps, ResourceManager will use this attribute to determine whether to search /// for embedded or PRI resources. /// </summary> [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] public sealed class HasEmbeddedStringResourcesAttribute : Attribute { } }
mit
C#
8d667fc1e86dc977cf40719e986b326879e51dfb
Add failing test for issue GH-837
ericgreenmix/marten,jokokko/marten,mdissel/Marten,jokokko/marten,mysticmind/marten,jokokko/marten,JasperFx/Marten,mysticmind/marten,ericgreenmix/marten,jokokko/marten,ericgreenmix/marten,JasperFx/Marten,mysticmind/marten,jokokko/marten,mdissel/Marten,ericgreenmix/marten,mysticmind/marten,JasperFx/Marten
src/Marten.Testing/Bugs/Bug_837_missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema.cs
src/Marten.Testing/Bugs/Bug_837_missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema.cs
using System; using System.Linq; using Marten.Schema; using Marten.Testing.Documents; using Xunit; namespace Marten.Testing.Bugs { public class Bug_837_missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema : IntegratedFixture { [Fact] public void missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema() { var store = DocumentStore.For(_ => { _.AutoCreateSchemaObjects = AutoCreate.All; _.DatabaseSchemaName = "other1"; _.Connection(ConnectionSource.ConnectionString); }); using (var session = store.OpenSession()) { session.Query<Target>().FirstOrDefault(m => m.DateOffset > DateTimeOffset.Now); } } } }
mit
C#
b1cf014dc21a2dd61040522df015de5e4b6ed02a
Add test coverage of EF to Realm migration process
ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu
osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs
osu.Game.Tests/Visual/Navigation/TestEFToRealmMigration.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Models; using osu.Game.Scoring; using osu.Game.Skinning; using osu.Game.Tests.Resources; namespace osu.Game.Tests.Visual.Navigation { public class TestEFToRealmMigration : OsuGameTestScene { public override void RecycleLocalStorage(bool isDisposing) { base.RecycleLocalStorage(isDisposing); if (isDisposing) return; using (var outStream = LocalStorage.GetStream(DatabaseContextFactory.DATABASE_NAME, FileAccess.Write, FileMode.Create)) using (var stream = TestResources.OpenResource(DatabaseContextFactory.DATABASE_NAME)) stream.CopyTo(outStream); } [Test] public void TestMigration() { // Numbers are taken from the test database (see commit f03de16ee5a46deac3b5f2ca1edfba5c4c5dca7d). AddAssert("Check beatmaps", () => Game.Dependencies.Get<RealmAccess>().Run(r => r.All<BeatmapSetInfo>().Count(s => !s.Protected) == 1)); AddAssert("Check skins", () => Game.Dependencies.Get<RealmAccess>().Run(r => r.All<SkinInfo>().Count(s => !s.Protected) == 1)); AddAssert("Check scores", () => Game.Dependencies.Get<RealmAccess>().Run(r => r.All<ScoreInfo>().Count() == 1)); // One extra file is created during realm migration / startup due to the circles intro import. AddAssert("Check files", () => Game.Dependencies.Get<RealmAccess>().Run(r => r.All<RealmFile>().Count() == 271)); } } }
mit
C#
34d56ef604e787d72c5c533591305a151ee79103
add IRequestMeta for extensibility
Research-Institute/json-api-dotnet-core,Research-Institute/json-api-dotnet-core,json-api-dotnet/JsonApiDotNetCore
src/JsonApiDotNetCore/Services/IRequestMeta.cs
src/JsonApiDotNetCore/Services/IRequestMeta.cs
using System.Collections.Generic; namespace JsonApiDotNetCore.Services { public interface IRequestMeta { Dictionary<string, object> GetMeta(); } }
mit
C#
223096eb6ebbf1c03bb3aa2cb59b68442b507018
Add missing unit test file
ilovepi/Compiler,ilovepi/Compiler
compiler/NUnit.Tests/Middle-End/InstructionTests.cs
compiler/NUnit.Tests/Middle-End/InstructionTests.cs
using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using compiler.middleend.ir; namespace NUnit.Tests.Middle_End { [TestFixture] public class InstructionTests { [Test] public void ToStringTest() { var inst1 = new Instruction(IrOps.add, new Operand(Operand.OpType.Constant, 10), new Operand(Operand.OpType.Identifier, 10)); var inst2 = new Instruction(IrOps.add, new Operand(Operand.OpType.Constant, 05), new Operand(inst1)); Assert.AreEqual( inst2.Num.ToString() + " add #5 (" + inst1.Num.ToString() + ")",inst2.ToString()); } } }
mit
C#
20304af1be8a2c72b2288e58bb0cac8ad0647b05
Create TemporalRecord.cs
efruchter/UnityUtilities
MiscDataStructures/TemporalRecord.cs
MiscDataStructures/TemporalRecord.cs
using System.Collections.Generic; using Unity.Mathematics; using UnityEngine; namespace ADT { public class TemporalRecord<T> { public struct Record { public float time; public T t; } public float GetDuration() { if (_records.Count > 0) { return _records[_records.Count - 1].time; } return 0; } List<Record> _records = new List<Record>(); /// <summary> /// Add a record. Inserting records is nlogn, try to only add records to the end. /// </summary> /// <param name="record"></param> /// <param name="time"></param> public void AddRecord(in T record, in float time) { Record rec = new Record { t = record, time = time }; if (_records.Count == 0) { _records.Add(rec); return; } if (_records[_records.Count - 1].time < time) { _records.Add(rec); return; } // TODO: Insert the record with Binary Search _records.Add(rec); _records.Sort((a, b) => a.time.CompareTo(b.time)); } /// <summary> /// A function that lerps between a and b by blend factor t. /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <param name="t"></param> /// <returns>The blended data.</returns> public delegate T LerpingFunction(T a, T b, float t); public T GetNearestVal(in float time) { return GetBlendedVal(time, (a, b, t) => (t < 0.5f) ? a : b); } /// <summary> /// Retrieve blended record and use a custom lerp to blend. O(logn) to pull a record. /// </summary> /// <param name="time"></param> /// <param name="lerpingFunction"></param> /// <returns></returns> public T GetBlendedVal(in float time, in LerpingFunction lerpingFunction) { if (lerpingFunction == null) { return GetNearestVal(time); } if (_records.Count < 1) return default; if (_records.Count == 1) return _records[0].t; if (time >= _records[_records.Count - 1].time) return _records[_records.Count - 1].t; if (time <= _records[0].time) return _records[0].t; int L = 0, R = _records.Count - 2; while (L <= R) { int M = (L + R) / 2; if (_records[M].time <= time && _records[M + 1].time >= time) { float blend = BurstMath.Map(time, math.float2(_records[M].time, _records[M + 1].time), math.float2(0, 1)); return lerpingFunction(_records[M].t, _records[M + 1].t, blend); } if (_records[M].time < time) L = M + 1; else if (_records[M].time > time) R = M - 1; } return default; } public void Clear() { _records.Clear(); } /// <summary> /// Remove every other entry except the caps. /// </summary> public void SimplifyHalf() { for (int i = _records.Count - 2; i > 0; i -= 2) _records.RemoveAt(i); } } }
mit
C#
dcae8462711ea2c9c1343131fca9db92ef0382e8
Add unfinished ArticleTest
RehanSaeed/Schema.NET
Tests/Schema.NET.Test/ArticleTest.cs
Tests/Schema.NET.Test/ArticleTest.cs
namespace Schema.NET.Test { using System; using Xunit; public class ArticleTest { [Fact] public void ToString_ArticleGoogleStructuredData_ReturnsExpectedJsonLd() { var article = new Article() { MainEntityOfPage = new Uri("https://google.com/article"), Headline = "Article headline", Image = new ImageObject() { Url = new Uri("https://google.com/thumbnail1.jpg"), Height = "800", Width = "800" } }; var expectedJson = "{" + "\"@context\":\"http://schema.org\"," + "\"@type\":\"NewsArticle\"," + "\"mainEntityOfPage\":\"https://google.com/article\"" + "\"headline\":\"Article headline\"," + "\"image\":{" + "\"@type\":\"ImageObject\"," + "\"url\":\"https://google.com/thumbnail1.jpg\"," + "\"height\":800," + "\"width\":800" + "}," + "\"datePublished\":\"2015-02-05T08:00:00+08:00\"," + "\"dateModified\":\"2015-02-05T09:20:00+08:00\"," + "\"author\":{" + "\"@type\":\"Person\"," + "\"name\":\"John Doe\"" + "}," + "\"publisher\":{" + "\"@type\":\"Organization\"," + "\"name\":\"Google\"," + "\"logo\":{" + "\"@type\":\"ImageObject\"," + "\"url\":\"https://google.com/logo.jpg\"," + "\"width\":600," + "\"height\":60" + "}" + "}," + "\"description\":\"A most wonderful article\"" + "}"; var json = article.ToString(); Assert.Equal(expectedJson, json); } } }
mit
C#
c7750ae0f8bdf362165b98789a1c46ecd9eaae56
Add GlobalSuppressions
bytefish/PostgreSQLCopyHelper
src/PostgreSQLCopyHelper.Test/GlobalSuppressions.cs
src/PostgreSQLCopyHelper.Test/GlobalSuppressions.cs
// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "Test Library")]
mit
C#
326686d26a17d4fe8779cdcbce318a53bd921514
Add Extension Methods for WebSocket->IGuild
AntiTcb/Discord.Net,RogueException/Discord.Net,Confruggy/Discord.Net,Joe4evr/Discord.Net,LassieME/Discord.Net
src/Discord.Net/WebSocket/Extensions/GuildExtensions.cs
src/Discord.Net/WebSocket/Extensions/GuildExtensions.cs
using System.Collections.Generic; using System.Linq; namespace Discord.WebSocket.Extensions { // TODO: Docstrings public static class GuildExtensions { // Channels public static IGuildChannel GetChannel(this IGuild guild, ulong id) => (guild as SocketGuild).GetChannel(id); public static ITextChannel GetTextChannel(this IGuild guild, ulong id) => (guild as SocketGuild).GetChannel(id) as ITextChannel; public static IEnumerable<ITextChannel> GetTextChannels(this IGuild guild) => (guild as SocketGuild).Channels.Select(c => c as ITextChannel).Where(c => c != null); public static IVoiceChannel GetVoiceChannel(this IGuild guild, ulong id) => (guild as SocketGuild).GetChannel(id) as IVoiceChannel; public static IEnumerable<IVoiceChannel> GetVoiceChannels(this IGuild guild) => (guild as SocketGuild).Channels.Select(c => c as IVoiceChannel).Where(c => c != null); // Users public static IGuildUser GetCurrentUser(this IGuild guild) => (guild as SocketGuild).CurrentUser; public static IGuildUser GetUser(this IGuild guild, ulong id) => (guild as SocketGuild).GetUser(id); public static IEnumerable<IGuildUser> GetUsers(this IGuild guild) => (guild as SocketGuild).Members; public static int GetUserCount(this IGuild guild) => (guild as SocketGuild).MemberCount; public static int GetCachedUserCount(this IGuild guild) => (guild as SocketGuild).DownloadedMemberCount; } }
mit
C#
8b1a71f4ca4ca073f762cc45521f6b0826128f8f
Add extension method for null-forgiving operator
ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework
osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs
osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; #nullable enable namespace osu.Framework.Extensions.ObjectExtensions { /// <summary> /// Extensions that apply to all objects. /// </summary> public static class ObjectExtensions { /// <summary> /// Coerces a nullable object as non-nullable. This is an alternative to the C# 8 null-forgiving operator "<c>!</c>". /// </summary> /// <remarks> /// This should only be used when when an assertion or other handling is not a reasonable alternative. /// </remarks> /// <param name="obj">The nullable object.</param> /// <typeparam name="T">The type of the object.</typeparam> /// <returns>The non-nullable object corresponding to <paramref name="obj"/>.</returns> public static T AsNonNull<T>(this T? obj) where T : class { Debug.Assert(obj != null); return obj; } } }
mit
C#
034703729e26d31521714fe9286f8232ce959bfe
Add EnumerableExtensions.ToPropertyDictionary for usage with anonymous types
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/Utilities/Collections/Object.ToPropertyDictionary.cs
source/Nuke.Common/Utilities/Collections/Object.ToPropertyDictionary.cs
// Copyright Matthias Koch, Sebastian Karasek 2018. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace Nuke.Common.Utilities.Collections { partial class EnumerableExtensions { public static IReadOnlyDictionary<TKey, TValue> ToPropertyDictionary<T, TKey, TValue>( this T obj, Func<PropertyInfo, TKey> keySelector, Func<object, TValue> valueSelector) { var type = obj.GetType(); var properties = type.GetProperties().Where(x => x.GetIndexParameters().Length == 0); return properties.ToDictionary(keySelector, x => valueSelector(x.GetValue(obj: obj))).AsReadOnly(); } } }
mit
C#
ae076f069cf7f8fea03d892123f6d82b8acb6bc4
Add Bulk extension method
fhelje/ElasticPlayground
ElasticPlayground.Indexing/EnumerableExtensions.cs
ElasticPlayground.Indexing/EnumerableExtensions.cs
using System.Collections.Generic; using System.Linq; namespace ElasticPlayground.Indexing { public static class EnumerableExtensions { public static IEnumerable<IEnumerable<TSource>> Batch<TSource>( this IEnumerable<TSource> source, int size) { TSource[] bucket = null; var count = 0; foreach (var item in source) { if (bucket == null) bucket = new TSource[size]; bucket[count++] = item; if (count != size) continue; yield return bucket; bucket = null; count = 0; } if (bucket != null && count > 0) yield return bucket.Take(count); } } }
mit
C#
ee89412859010808f40d6c20d7842311f18f4263
Switch MonitorRecord from ITimeStamped interface
ZocDoc/ZocMon,ZocDoc/ZocMon,modulexcite/ZocMon,modulexcite/ZocMon,modulexcite/ZocMon,ZocDoc/ZocMon
ZocMon/ZocMon/ZocMonLib/Framework/MonitorRecord.cs
ZocMon/ZocMon/ZocMonLib/Framework/MonitorRecord.cs
using System; namespace ZocMonLib { /// <summary> /// Record that captures the record of occurance of a given monitor info. /// </summary> /// <typeparam name="T">Data type that is being collected</typeparam> public class MonitorRecord<T> : IComparable<MonitorRecord<T>> { public MonitorRecord() { } public MonitorRecord(T value) : this(DateTime.Now, value) { } public MonitorRecord(DateTime time, T value) : this(time, value, 1) { } public MonitorRecord(DateTime time, T value, int number) { this.TimeStamp = time; this.Value = value; this.Number = number; } /// <summary> /// Time that the event occured /// </summary> public DateTime TimeStamp { get; set; } /// <summary> /// Value that we are storeing against this event /// </summary> public T Value { get; set; } /// <summary> /// The number of records that merged into this record /// </summary> public int Number { get; set; } /// <summary> /// Tracks the total sum of all the values collected so far /// </summary> public double IntervalSum { get; set; } public double IntervalSumOfSquares { get; set; } public int ReduceLevelId { get; set; } public int CompareTo(MonitorRecord<T> other) { return TimeStamp.CompareTo(other.TimeStamp); } public override string ToString() { return string.Format("TimeStamp: {0}, Value: {1}, Number: {2}, IntervalSum: {3}, IntervalSumOfSquares: {4}", TimeStamp, Value, Number, IntervalSum, IntervalSumOfSquares); } } }
using System; namespace ZocMonLib { /// <summary> /// Record that captures the record of occurance of a given monitor info. /// </summary> /// <typeparam name="T">Data type that is being collected</typeparam> public class MonitorRecord<T> : IComparable<MonitorRecord<T>>, ITimeStamped { public MonitorRecord() { } public MonitorRecord(T value) : this(DateTime.Now, value) { } public MonitorRecord(DateTime time, T value) : this(time, value, 1) { } public MonitorRecord(DateTime time, T value, int number) { this.TimeStamp = time; this.Value = value; this.Number = number; } /// <summary> /// Time that the event occured /// </summary> public DateTime TimeStamp { get; set; } /// <summary> /// Value that we are storeing against this event /// </summary> public T Value { get; set; } /// <summary> /// The number of records that merged into this record /// </summary> public int Number { get; set; } /// <summary> /// Tracks the total sum of all the values collected so far /// </summary> public double IntervalSum { get; set; } public double IntervalSumOfSquares { get; set; } public int ReduceLevelId { get; set; } public int CompareTo(MonitorRecord<T> other) { return TimeStamp.CompareTo(other.TimeStamp); } public override string ToString() { return string.Format("TimeStamp: {0}, Value: {1}, Number: {2}, IntervalSum: {3}, IntervalSumOfSquares: {4}", TimeStamp, Value, Number, IntervalSum, IntervalSumOfSquares); } } }
apache-2.0
C#
5f37ffec4fea7773120ad3c33644a034f996049c
Create SyncConflictPageViewModel.cs
scherke/windows-universal,altima/windows-universal,altima/windows-universal,DecaTec/windows-universal,TheScientist/windows-universal,altima/windows-universal,DecaTec/windows-universal,scherke/windows-universal,scherke85/windows-universal,SunboX/windows-universal,DecaTec/windows-universal,TheScientist/windows-universal,SunboX/windows-universal,scherke/windows-universal,SunboX/windows-universal,scherke85/windows-universal,TheScientist/windows-universal,scherke85/windows-universal
NextcloudApp/ViewModels/SyncConflictPageViewModel.cs
NextcloudApp/ViewModels/SyncConflictPageViewModel.cs
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.IO; using System.Windows.Input; using Windows.Networking.Connectivity; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media.Imaging; using NextcloudApp.Converter; using NextcloudApp.Models; using NextcloudApp.Services; using NextcloudApp.Utils; using NextcloudClient.Exceptions; using Prism.Commands; using Prism.Windows.Navigation; using NextcloudClient.Types; using Prism.Windows.AppModel; namespace NextcloudApp.ViewModels { public class SyncConflictPageViewModel : ViewModel { private readonly INavigationService _navigationService; private readonly IResourceLoader _resourceLoader; private readonly DialogService _dialogService; public ICommand FixConflictByLocalCommand { get; private set; } public SyncConflictPageViewModel(INavigationService navigationService, IResourceLoader resourceLoader, DialogService dialogService) { _navigationService = navigationService; _resourceLoader = resourceLoader; _dialogService = dialogService; FixConflictByLocalCommand = new DelegateCommand(FixConflictByLocal); } private async void FixConflictByLocal() { } } }
mpl-2.0
C#
b40b24cb75ad4f184d4c7784a1ba381019e3a39f
add missing file
EdneySilva/Venom
Venom.Lib/Util/ApplicationResource.pt-Br.Designer.cs
Venom.Lib/Util/ApplicationResource.pt-Br.Designer.cs
mit
C#
73202eb8e6c13ad086ad68f7acb20f7160cb7639
Add benchmark
ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework
osu.Framework.Benchmarks/BenchmarkColourInfo.cs
osu.Framework.Benchmarks/BenchmarkColourInfo.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using BenchmarkDotNet.Attributes; using osu.Framework.Graphics.Colour; using osuTK.Graphics; namespace osu.Framework.Benchmarks { [MemoryDiagnoser] public class BenchmarkColourInfo { private ColourInfo colourInfo; [GlobalSetup] public void GlobalSetup() { colourInfo = ColourInfo.SingleColour(Color4.Transparent); } [Benchmark] public SRGBColour ConvertToSRGBColour() => colourInfo; [Benchmark] public Color4 ConvertToColor4() => ((SRGBColour)colourInfo).Linear; } }
mit
C#
3090a976d58ae6f86e1851141ed8c9dd415aca73
Revert "Pack nuget on build"
whir1/serilog-sinks-graylog
src/Serilog.Sinks.Graylog/Properties/AssemblyInfo.cs
src/Serilog.Sinks.Graylog/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Serilog sync for Graylog")] [assembly: AssemblyDescription("The Serilog Graylog Sink project is a sink (basically a writer) for the Serilog logging framework. Structured log events are written to sinks and each sink is responsible for writing it to its own backend, database, store etc. This sink delivers the data to Graylog2, a NoSQL search engine.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Serilog.Sinks.Graylog")] [assembly: AssemblyCopyright("whirlwind432@gmail.com Copyright © 2016")] [assembly: AssemblyCompany("Anton Volkov")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyInformationalVersion("1.0.0-master")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("3466c882-d569-4ca5-8db6-0ea53c5a5c57")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0")]
mit
C#
fb6caf0f4e7a15bf3f0b900f2e5c86dd295e802e
Add missing file
segrived/Msiler
Msiler/HighlightSchemes/IListingHighlightingScheme.cs
Msiler/HighlightSchemes/IListingHighlightingScheme.cs
namespace Msiler.HighlightSchemes { public interface IListingHighlightingScheme { IListingHighlightingSchemeDef GetScheme(); } }
mit
C#
37a66603457e24b65942d7905a9afb59b7d47cdd
Add test for persisting cached value under different culture.
b0bi79/ClosedXML,igitur/ClosedXML,ClosedXML/ClosedXML
ClosedXML_Tests/Excel/Globalization/GlobalizationTests.cs
ClosedXML_Tests/Excel/Globalization/GlobalizationTests.cs
using ClosedXML.Excel; using NUnit.Framework; using System.IO; using System.Threading; namespace ClosedXML_Tests.Excel.Globalization { [TestFixture] public class GlobalizationTests { [Test] [TestCase("A1*10", "1230")] [TestCase("A1/10", "12.3")] [TestCase("A1&\" cells\"", "123 cells")] [TestCase("A1&\"000\"", "123000")] [TestCase("ISNUMBER(A1)", "True")] [TestCase("ISBLANK(A1)", "False")] [TestCase("DATE(2018,1,28)", "43128")] public void LoadFormulaCachedValue(string formula, object expectedValue) { Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ru-RU"); using (var ms = new MemoryStream()) { using (XLWorkbook book1 = new XLWorkbook()) { var sheet = book1.AddWorksheet("sheet1"); sheet.Cell("A1").Value = 123; sheet.Cell("A2").FormulaA1 = formula; var options = new SaveOptions { EvaluateFormulasBeforeSaving = true }; book1.SaveAs(ms, options); } ms.Position = 0; using (XLWorkbook book2 = new XLWorkbook(ms)) { var ws = book2.Worksheet(1); var storedValueA2 = ws.Cell("A2").ValueCached; Assert.IsTrue(ws.Cell("A2").NeedsRecalculation); Assert.AreEqual(expectedValue, storedValueA2); } } } } }
mit
C#
7b36799494d3a33f6ecea293f4ca656680f3ec02
Create AltriaPendragonAlterSaber.cs
Keripo/fgo-data
webservice/src/Models/Data/Servants/AltriaPendragonAlterSaber.cs
webservice/src/Models/Data/Servants/AltriaPendragonAlterSaber.cs
using FGOData.Models.Serialization; using System.Collections.Generic; namespace FGOData.Models.Data { public class AltriaPendragonAlterSaber : Servant { public AltriaPendragonAlterSaber() { Id = 3; Name_EN = "Altria Pendragon (Alter)"; Name_JP = "アルトリア・ペンドラゴン[オルタ]"; Class = ClassType.Saber; Cost = 12; Rarity = 4; Gender = GenderType.Female; Attribute = AttributeType.Man; Traits = new List<TraitType> { TraitType.Arthur, TraitType.Dragon, TraitType.Evil TraitType.Humanoid, TraitType.Saberface, TraitType.Servant, TraitType.WeakToEnumaElish, TraitType.King }; Aligments = new List<AlignmentType> { AlignmentType.Lawful, AlignmentType.Evil }; StarWeight = 99; StarRate = 9.9f; NPGainAtk = 0.86f; NPGainDef = 3.0f; DeathRate = 19.2f; InterludeCount = 2; Cards = new List<Card> { new Card(CardType.Quick, 2), new Card(CardType.Arts, 2), new Card(CardType.Arts, 2), new Card(CardType.Buster, 1), new Card(CardType.Buster, 1), new Card(CardType.Extra, 3), }; NoblePhantasm = new List<NoblePhantasm> { new ExcaliburMorganA() }; ActiveSkills = new List<ActiveSkill> { new ManaBurstA(), new IntuitionB(), new CharismaE() }; PassiveSkills = new List<PassiveSkill> { new MagicResistanceB() }; Stats = new List<StatValues> { new StatValues(1, 1854, 1708), new StatValues(40, 6809, 6054), new StatValues(50, 8687, 7703), new StatValues(60, 10255, 9078), new StatValues(70, 11277, 9974), new StatValues(80, 11589, 10248), new StatValues(90, 12815, 11324), new StatValues(100, 14051, 12408) }; } } }
apache-2.0
C#
b529ca49c0c2497c1c71935956b440db749e21b3
Update token-generation-server.4.x.cs
TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets
video/users/token-generation-server/token-generation-server.4.x.cs
video/users/token-generation-server/token-generation-server.4.x.cs
using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; using System.Web.Mvc; using Twilio; using Twilio.Auth; using JWT; using Faker; namespace VideoQuickstart.Controllers { public class TokenController : Controller { // GET: /token public ActionResult Index(string Device) { // Load Twilio configuration from Web.config var accountSid = ConfigurationManager.AppSettings["TwilioAccountSid"]; var apiKey = ConfigurationManager.AppSettings["TwilioApiKey"]; var apiSecret = ConfigurationManager.AppSettings["TwilioApiSecret"]; var videoConfigSid = ConfigurationManager.AppSettings["TwilioConfigurationSid"]; // Create a random identity for the client var identity = Internet.UserName(); // Create an Access Token generator var token = new AccessToken(accountSid, apiKey, apiSecret); token.Identity = identity; // Create a video (Conversations SDK) grant for this token var grant = new VideoGrant(); token.AddGrant(grant); return Json(new { identity = identity, token = token.ToJWT() }, JsonRequestBehavior.AllowGet); } } }
using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; using System.Web.Mvc; using Twilio; using Twilio.Auth; using JWT; using Faker; namespace VideoQuickstart.Controllers { public class TokenController : Controller { // GET: /token public ActionResult Index(string Device) { // Load Twilio configuration from Web.config var accountSid = ConfigurationManager.AppSettings["TwilioAccountSid"]; var apiKey = ConfigurationManager.AppSettings["TwilioApiKey"]; var apiSecret = ConfigurationManager.AppSettings["TwilioApiSecret"]; var videoConfigSid = ConfigurationManager.AppSettings["TwilioConfigurationSid"]; // Create a random identity for the client var identity = Internet.UserName(); // Create an Access Token generator var token = new AccessToken(accountSid, apiKey, apiSecret); token.Identity = identity; // Create a video (Conversations SDK) grant for this token var grant = new ConversationsGrant(); token.AddGrant(grant); return Json(new { identity = identity, token = token.ToJWT() }, JsonRequestBehavior.AllowGet); } } }
mit
C#
64a25c3aaef0c7b6077f496955878278c93a711c
rename Pxory to ProxyDescriptor
AspectCore/AspectCore-Framework,AspectCore/Abstractions,AspectCore/AspectCore-Framework,AspectCore/Lite
src/AspectCore.Lite.Abstractions/ProxyDescriptor.cs
src/AspectCore.Lite.Abstractions/ProxyDescriptor.cs
using System; using System.Reflection; namespace AspectCore.Lite.Abstractions { public sealed class ProxyDescriptor { public object ProxyInstance { get; } public MethodInfo ProxyMethod { get; } public Type ProxyType { get; set; } public ProxyDescriptor(object proxyInstance, MethodInfo proxyMethod, Type proxyType) { if (proxyInstance == null) { throw new ArgumentNullException(nameof(proxyInstance)); } if (proxyMethod == null) { throw new ArgumentNullException(nameof(proxyMethod)); } if (proxyType == null) { throw new ArgumentNullException(nameof(proxyType)); } ProxyType = proxyType; ProxyMethod = proxyMethod; ProxyInstance = proxyInstance; } } }
mit
C#
88578631a340e2d7773b4cacb702c184a96cd3cd
add skeleton of ReadonlyRepository
HighwayFramework/Highway.Data,ericburcham/Highway.Data
src/Highway.Data/Repositories/ReadonlyRepository.cs
src/Highway.Data/Repositories/ReadonlyRepository.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Highway.Data { public class ReadonlyRepository : IReadonlyRepository { public IReadonlyDataContext Context { get; } public T Find<T>(IScalar<T> scalar) { throw new NotImplementedException(); } public IEnumerable<T> Find<T>(IQuery<T> query) { throw new NotImplementedException(); } public Task<T> FindAsync<T>(IScalar<T> scalar) { throw new NotImplementedException(); } public Task<IEnumerable<T>> FindAsync<T>(IQuery<T> query) { throw new NotImplementedException(); } public Task<IEnumerable<TProjection>> FindAsync<TSelection, TProjection>(IQuery<TSelection, TProjection> query) where TSelection : class { throw new NotImplementedException(); } } }
mit
C#
38fc9347bec98496ff03a8b6f72fb0f5d18c17d0
Add failing test coverage for beatmap skin disable
ppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu
osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs
osu.Game.Tests/Skins/TestSceneBeatmapSkinLookupDisables.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Textures; using osu.Framework.Testing; using osu.Game.Audio; using osu.Game.Configuration; using osu.Game.Rulesets.Osu; using osu.Game.Skinning; using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Visual; namespace osu.Game.Tests.Skins { [TestFixture] [HeadlessTest] public class TestSceneBeatmapSkinLookupDisables : OsuTestScene { private UserSkinSource userSource; private BeatmapSkinSource beatmapSource; private SkinRequester requester; [Resolved] private OsuConfigManager config { get; set; } [SetUp] public void SetUp() => Schedule(() => { Add(new SkinProvidingContainer(userSource = new UserSkinSource()) .WithChild(new BeatmapSkinProvidingContainer(beatmapSource = new BeatmapSkinSource()) .WithChild(requester = new SkinRequester()))); }); [TestCase(false)] [TestCase(true)] public void TestDrawableLookup(bool allowBeatmapLookups) { AddStep($"Set beatmap skin enabled to {allowBeatmapLookups}", () => config.SetValue(OsuSetting.BeatmapSkins, allowBeatmapLookups)); string expected = allowBeatmapLookups ? "beatmap" : "user"; AddAssert($"Check lookup is from {expected}", () => requester.GetDrawableComponent(new TestSkinComponent())?.Name == expected); } [TestCase(false)] [TestCase(true)] public void TestProviderLookup(bool allowBeatmapLookups) { AddStep($"Set beatmap skin enabled to {allowBeatmapLookups}", () => config.SetValue(OsuSetting.BeatmapSkins, allowBeatmapLookups)); ISkin expected() => allowBeatmapLookups ? (ISkin)beatmapSource : userSource; AddAssert($"Check lookup is from correct source", () => requester.FindProvider(s => s.GetDrawableComponent(new TestSkinComponent()) != null) == expected()); } public class UserSkinSource : LegacySkin { public UserSkinSource() : base(new SkinInfo(), null, null, string.Empty) { } public override Drawable GetDrawableComponent(ISkinComponent component) { return new Container { Name = "user" }; } } public class BeatmapSkinSource : LegacyBeatmapSkin { public BeatmapSkinSource() : base(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo, null, null) { } public override Drawable GetDrawableComponent(ISkinComponent component) { return new Container { Name = "beatmap" }; } } public class SkinRequester : Drawable, ISkin { private ISkinSource skin; [BackgroundDependencyLoader] private void load(ISkinSource skin) { this.skin = skin; } public Drawable GetDrawableComponent(ISkinComponent component) => skin.GetDrawableComponent(component); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT); public ISample GetSample(ISampleInfo sampleInfo) => skin.GetSample(sampleInfo); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => skin.GetConfig<TLookup, TValue>(lookup); public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => skin.FindProvider(lookupFunction); } private class TestSkinComponent : ISkinComponent { public string LookupName => string.Empty; } } }
mit
C#
42749f4e3c4f1a10464b04583f2cd220b6d07492
Create DeleteStatCommandHandler.cs
NinjaVault/NinjaHive,NinjaVault/NinjaHive
NinjaHive.BusinessLayer/CommandHandlers/DeleteStatCommandHandler.cs
NinjaHive.BusinessLayer/CommandHandlers/DeleteStatCommandHandler.cs
using NinjaHive.Contract.Commands; using NinjaHive.Core; using NinjaHive.Domain; namespace NinjaHive.BusinessLayer.CommandHandlers { public class DeleteStatCommandHandler : ICommandHandler<DeleteStatCommand> { private readonly IRepository<StatInfoEntity> statRepository; public DeleteStatCommandHandler(IRepository<StatInfoEntity> statRepository) { this.statRepository = statRepository; } public void Handle(DeleteStatCommand command) { var stat = this.statRepository.GetById(command.Stat.Id); this.statRepository.Remove(stat); } } }
apache-2.0
C#