Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Update server side API for single multiple answer question
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 ...
Add accelerometer reader example script
using UnityEngine; using System.Collections; public class AccelerometerReader : MonoBehaviour { public float Filter = 5.0f; public GUIText Label; private Vector3 accel; void Start() { accel = Input.acceleration; } void Update() { // filter the jerky acceleration in the variab...
Convert int to string column
// http://careercup.com/question?id=5690323227377664 // // Write a function which takes an integer and convert to string as: // 1 - A 0001 // 2 - B 0010 // 3 - AA 0011 // 4 - AB 0100 // 5 - BA 0101 // 6 - BB 0110 // 7 - AAA 0111 // 8 - AAB 1000 // 9 - ABA 10...
Add Eric Lippert's backport of Zip() to .NET 3.5.
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace open3mod { // Zip() was added in .NET 4.0. // http://blogs.msdn.com/b/ericlippert/archive/2009/05/07/zip-me-up.aspx public static class LinqZipNet4Backport { public static IEnumerable<TResult> Zip<T...
Add test coverage of accuracy formatting function
// 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.Game.Utils; namespace osu.Game.Tests.NonVisual { [TestFixture] public class FormatUtilsTest { [TestCase(0, "0.00%")]...
Add too few players exception
// TooFewPlayersException.cs // <copyright file="TooFewPlayersException.cs"> This code is protected under the MIT License. </copyright> using System; namespace CardGames { /// <summary> /// An exception raised when TooFewPlayers are added to a game. /// </summary> [Serializable] public c...
Set up results output interface
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TimeNetSync.Services { public interface IResultsOutput { } }
Fix autosave and refresh on shared projects
using JetBrains.Annotations; using JetBrains.Application.changes; using JetBrains.Application.FileSystemTracker; using JetBrains.Application.Threading; using JetBrains.DocumentManagers; using JetBrains.DocumentModel; using JetBrains.Lifetimes; using JetBrains.ProjectModel; using JetBrains.ReSharper.Host.Features.Docume...
Verify NotifyFault called will properly fail a filter execution
namespace MassTransit.Tests { using System; using System.Threading.Tasks; using MassTransit.Testing; using Microsoft.Extensions.DependencyInjection; using Middleware; using NUnit.Framework; using TestFramework.Messages; [TestFixture] public class Using_a_request_filter_with_request...
Add models for notification emails.
using System; namespace CompetitionPlatform.Models { public class Initiative { public string FirstName { get; set; } public string ProjectId { get; set; } public DateTime ProjectCreatedDate { get; set; } public string ProjectAuthorName { get; set; } public string Projec...
Add a function to compute hit object position in catch editor
// 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.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI.Scrolling; using osuTK; namespace osu.Game.Rulesets.Catch.Edit { /...
Add a new datatype for skeletons
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using Microsoft.Kinect; using System.IO; namespace MultipleKinectsPlatform.MultipleKinectsPlatform...
Add some simple test cases for SetProperty.
using System; using GamesWithGravitas.Extensions; using Xunit; namespace GamesWithGravitas { public class NotifyPropertyChangedBaseTests { [Theory] [InlineData("Foo")] [InlineData("Bar")] public void SettingAPropertyWorks(string propertyValue) { var notifier...
Add tests for losing audio devices
// 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 System.Threading; using NUnit.Framework; using osu.Framework.IO.Stores; using osu.Framework.Threading; namespace osu.Framework.Tests.Audio { ///...
Add test that asserts records don't have RecordAttribute in reflection
using Amadevus.RecordGenerator.TestsBase; using Xunit; namespace Amadevus.RecordGenerator.Test { public class RecordClassTests : RecordTestsBase { [Fact] public void ReflectedClass_HasNo_RecordAttribute() { var recordType = typeof(Item); var recordAttributes = ...
Move connection strings to separate file
using Windows.UI.Xaml.Controls; namespace WeatherDataReporter { public sealed partial class MainPage : Page { static string iotHubUri = "{replace}"; static string deviceKey = "{replace}"; static string deviceId = "{replace}"; } }
Add partial implementation to PPCompletionCallback
using System; using System.Runtime.InteropServices; namespace PepperSharp { public partial struct PPCompletionCallback { public PPCompletionCallback(PPCompletionCallbackFunc func) { this.func = func; this.user_data = IntPtr.Zero; this.flags = (int)PPComplet...
Add extension methods to export the Data Center's content.
using System.IO; using System.Linq; using System.Xml.Linq; namespace Tera.Analytics { public static class DataCenterExtensions { private static XStreamingElement ToXStreamingElement(DataCenterElement element) { var xElement = new XStreamingElement(element.Name); xElemen...
Add top level test coverage of editor shortcuts
// 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.Game.Rulesets; using osu.Game.Rulesets.Osu; using osuTK.Input; namespace osu.Game.Tests.Visual.Editing { /// <summary> /// Test ...
Add a basic application test
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System; namespace Tgstation.Server.Host.Core.Tests { [TestClass] public sealed class TestApplicat...
Rearrange chars - prep work
// http://careercup.com/question?id=5693863291256832 // // Rearrange chars in a String so that no adjacent chars repeat // using System; using System.Collections.Generic; using System.Linq; using System.Text; static class Program { static Random random = new Random(); static String Rearrange(this String s) ...
Add two extensions for RegionInfo.
// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information. namespace Narvalo.Finance { using System.Globalization; public static class RegionInfoExtensions { public static bool IsUsing(this RegionInfo @this, Currency currency) { ...
Add test coverage for common mime types
namespace AngleSharp.Core.Tests.Io { using AngleSharp.Io; using NUnit.Framework; [TestFixture] public class MimeTypeNameTests { [Test] public void CommonMimeTypesAreCorrectlyDefined() { Assert.AreEqual("image/avif", MimeTypeNames.FromExtension(".avif")); ...
Add separate facility for bit commitment
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BitCommitment { /// <summary> /// A class to perform bit commitment. It does not care what the input is; it's just a /// facility for exchanging bit commitment messages. /// <...
Add a basic kafka serilaizer
using System; using System.Text; using System.Threading.Tasks; using Confluent.Kafka; using Confluent.Kafka.SyncOverAsync; using Newtonsoft.Json; namespace Jasper.ConfluentKafka.Serialization { internal class DefaultJsonSerializer<T> : IAsyncSerializer<T> { public Task<byte[]> SerializeAsync(T data, Se...
Add default web socket client unit tests
using System; using System.Threading; using System.Threading.Tasks; using Binance.WebSocket; using Xunit; namespace Binance.Tests.WebSocket { public class DefaultWebSocketClientTest { [Fact] public async Task Throws() { var uri = new Uri("wss://stream.binance.com:9443"); ...
Add the producer wrap to donet
using System; using System.Runtime.InteropServices; namespace RocketMQ.Interop { public static class ProducerWrap { // init [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr CreateProducer(string groupId); [...
Add the NBench visual studio test adapter project.
namespace NBench.VisualStudio.TestAdapter { using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using System; using System.Collections.Generic; public class NBenchTestDiscoverer : ITestDiscoverer { public void Di...
Add script for fixing tecture scaling
using UnityEngine; using System.Collections; [ExecuteInEditMode] public class TextureTilingController : MonoBehaviour { // Give us the texture so that we can scale proportianally the width according to the height variable below // We will grab it from the meshRenderer //public Texture texture; //public float te...
Make primary key auto increment.
using System; namespace Toggl.Phoebe.Data.DataObjects { public abstract class CommonData { protected CommonData () { ModifiedAt = Time.UtcNow; } /// <summary> /// Initializes a new instance of the <see cref="Toggl.Phoebe.Data.DataObjects.CommonData"/> class...
using System; using SQLite; namespace Toggl.Phoebe.Data.DataObjects { public abstract class CommonData { protected CommonData () { ModifiedAt = Time.UtcNow; } /// <summary> /// Initializes a new instance of the <see cref="Toggl.Phoebe.Data.DataObjects.Commo...
Add test coverage for ignoring null mods returned by rulesets
// 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. #nullable enable using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game....
Change the check range for BaseAddress and EntryPointAddress
// 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.Linq; using Xunit; namespace System.Diagnostics.Tests { public class ProcessModuleTests : ProcessT...
// 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.Linq; using Xunit; namespace System.Diagnostics.Tests { public class ProcessModuleTests : ProcessT...
Fix startup error - setup root view controller
using UIKit; using Foundation; namespace OpenGLESSampleGameView { // The name AppDelegate is referenced in the MainWindow.xib file. public partial class OpenGLESSampleAppDelegate : UIApplicationDelegate { // This method is invoked when the application has loaded its UI and its ready to run public override bool...
using UIKit; using Foundation; namespace OpenGLESSampleGameView { // The name AppDelegate is referenced in the MainWindow.xib file. public partial class OpenGLESSampleAppDelegate : UIApplicationDelegate { // This method is invoked when the application has loaded its UI and its ready to run public override bool...
Add unit tests for the P2pkhIssuanceImplicitLayout class
// Copyright 2015 Coinprism, Inc. // // 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 agree...
Enable scanning at the assembly level for components for the dotnet CLI
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using Microsoft.TemplateEngine.Abstractions; namespace Microsoft.TemplateEngine.Edge { public class AssemblyComponentCatalog : IReadOnlyList<KeyValuePair<Guid, Func<Type>>> { private r...
Add tests for the ConsoleWriter
using System; using Xunit; using OutputColorizer; using System.IO; namespace UnitTests { public partial class ConsoleWriterTests { [Fact] public void TestGetForegroundColor() { ConsoleWriter cw = new ConsoleWriter(); Assert.Equal(Console.ForegroundColor, cw.Fore...
Add test that validates all reflected methods are non-null.
#region License // // Dasher // // Copyright 2015-2016 Drew Noakes // // 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 // // ...
Add work-in-progress ObjectOverrides pass that adds GetHashCode and Equals overrides.
using System; using System.Collections.Generic; using CppSharp.AST; using CppSharp.Generators; using CppSharp.Generators.CLI; using CppSharp.Passes; namespace CppSharp { public class ObjectOverridesPass : TranslationUnitPass { void OnUnitGenerated(GeneratorOutput output) { foreach ...
Use PropertyInfo control in mobile apps
using System; using System.Collections.Generic; using System.Globalization; using System.Text; using Xamarin.Forms; namespace ProjectTracker.Ui.Xamarin.Xaml { public class BoolColorConverter : IValueConverter { public Color TrueColor { get; set; } public Color FalseColor { get; set; } public bool Inve...
Add a model for transitions
using System; using slang.Lexing.Tokens; namespace slang.Lexing.Trees.Nodes { public class Transition { public Transition (Node target, Func<Token> tokenProducer = null) { Target = target; TokenProducer = tokenProducer; } public Token GetToken() ...
Add helper class to handle firing async multiplayer methods
// 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. #nullable enable using System; using System.Diagnostics; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR; using osu.Framework.Logging; namespace osu.Gam...
Add Singleton for the Session
using ScheduleManager.forms; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ScheduleManager.model; namespace ScheduleManager.common { class SingletonSesion { private volatile static SingletonSesion o...
Check if the query is a projection-query before trying to add it to the cache (nhibernate will choke on that)
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using NHibernate.Cache; using NHibernate.Cfg; using NHibernate.Engine; using NHibernate.Type; namespace BoC.Persistence.NHibernate.Cache { /// <summary> /// This class works around the ...
Add the skeleton for the temp attachments module
/* * 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 r...
Revert change to message assertion as the message is consumer key dependent and the key in the CI build causes a failure
using System; using NUnit.Framework; using SevenDigital.Api.Wrapper.Exceptions; using SevenDigital.Api.Schema.ArtistEndpoint; using SevenDigital.Api.Schema.LockerEndpoint; namespace SevenDigital.Api.Wrapper.Integration.Tests.Exceptions { [TestFixture] public class ApiXmlExceptionTests { [Test] public void Shoul...
using System; using NUnit.Framework; using SevenDigital.Api.Wrapper.Exceptions; using SevenDigital.Api.Schema.ArtistEndpoint; using SevenDigital.Api.Schema.LockerEndpoint; namespace SevenDigital.Api.Wrapper.Integration.Tests.Exceptions { [TestFixture] public class ApiXmlExceptionTests { [Test] public void Shoul...
Add characterization tests for object members
namespace FakeItEasy.Specs { using FakeItEasy.Core; using FluentAssertions; using Xbehave; public static class ObjectMembersSpecs { [Scenario] public static void DefaultEqualsWithSelf(IFoo fake, bool equals) { "Given a fake" .x(() => f...
Add ResourceFinder as an option that can be set.
namespace ZocMonLib.Web { public class WebSettingsExtensionOptions { public ISerializer Serializer { get; set; } public IRuntime Runtime { get; set; } public IStorageFactory StorageFactory { get; set; } public ISystemLoggerProvider LoggerProvider { get; set; } public ...
namespace ZocMonLib.Web { public class WebSettingsExtensionOptions { public IResourceFinder ResourceFinder { get; set; } public ISerializer Serializer { get; set; } public IRuntime Runtime { get; set; } public IStorageFactory StorageFactory { get; set; } public ISyste...
Support convert to or from struct type
// Copyright (c) kuicker.org. All rights reserved. // Modified By YYYY-MM-DD // kevinjong 2016-03-04 - Creation using System; namespace IsTo.Tests { public struct TestStruct { public int Property11; public int Property12; public int Property13; } }
Move sample to correct namespace
using BenchmarkDotNet.Tasks; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BenchmarkDotNet.Samples.Other { [BenchmarkTask(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.RyuJit)] public class Cpu_Atomics { private int a; pr...
using BenchmarkDotNet.Tasks; namespace BenchmarkDotNet.Samples.CPU { [BenchmarkTask(platform: BenchmarkPlatform.X64, jitVersion: BenchmarkJitVersion.RyuJit)] public class Cpu_Atomics { private int a; private object syncRoot = new object(); [Benchmark] [OperationsPerInvoke(...
Add test scene for `MultiplayerPlayer`
// 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.Linq; using NUnit.Framework; using osu.Framework.Testing; using osu.Game.Rulesets.Osu; using osu.Game.Screens.OnlinePlay.Multiplayer; namespace osu.Game.Tes...
Add a method for getting settings UI components automatically from a target class
// 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 System.Collections.Generic; using System.Linq; using System.Reflection; using JetBrains.Annotations; using osu.Framework.Bindables; using osu.Framewor...
Add possibility to mock ConfigurationManager
using System; using System.Configuration; using System.Linq; using System.Reflection; namespace UnitTests.Helpers { // the default app.config is used. /// <summary> /// Allow to override default configuration file access via ConfigurationService for piece of code /// Main purpose: uni...
Add ApplicationUser class for Identity and DbContext
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using System.Web; namespace Gnx.Models { public class ApplicationUser : IdentityUser { public...
Create read-only dictionary for .NET version 2.0
#if PS20 using System; using System.Collections.Generic; namespace WpfCLR { public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue> { public const string ReadOnlyErrorMessage = "Dictionary is read-only"; private IDictionary<TKey, TValue> _innerDictionary; protected IDictionary<TKey, TValu...
Sort chars by freq - monad
// https://leetcode.com/problems/sort-characters-by-frequency/ // https://leetcode.com/submissions/detail/83684155/ // // Submission Details // 34 / 34 test cases passed. // Status: Accepted // Runtime: 188 ms // Submitted: 0 minutes ago public class Solution { public string FrequencySort(st...
Fix inverted documentation between two methods
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace System.ComponentModel { /// <summary> /// Provides functionality to commit or rollback changes to an object that is used as a data source. /// </s...
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace System.ComponentModel { /// <summary> /// Provides functionality to commit or rollback changes to an object that is used as a data source. /// </s...
Check if an array is preorder
// http://www.geeksforgeeks.org/check-if-a-given-array-can-represent-preorder-traversal-of-binary-search-tree/ // // Given an array of numbers, return true if given array can represent preorder traversal of a Binary Search Tree, // else return false. Expected time complexity is O(n). // using System; using System.Coll...
Revert "remove old assemblyinfo (wasn't included in the solution)"
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("In...
Add type to request comment help
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol; namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer { class CommentHelp...
Introduce exponential backoff for executors
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Gremlin.Net.Driver.Exceptions; namespace ExRam.Gremlinq.Core { public static class GremlinQueryExecutorExtensions { private sealed class ExponentialBackoffExecutor : IGremlinQ...
Cover DelegateInvokingLoadBalancerCreator by unit tests.
using System; using System.Threading.Tasks; using Moq; using Ocelot.Configuration; using Ocelot.Configuration.Builder; using Ocelot.LoadBalancer.LoadBalancers; using Ocelot.Middleware; using Ocelot.Responses; using Ocelot.ServiceDiscovery.Providers; using Ocelot.Values; using Shouldly; using TestStack.BDDfy; using Xun...
Add http request reason provider for Abp.Web
using Abp.Dependency; using Abp.EntityHistory; using Abp.Runtime; using JetBrains.Annotations; using System.Web; namespace Abp.Web.EntityHistory { /// <summary> /// Implements <see cref="IEntityChangeSetReasonProvider"/> to get reason from HTTP request. /// </summary> public class HttpRequestEntityCha...
Add usability overload for IMockFactory
using System; using System.ComponentModel; using System.Reflection; namespace Moq.Sdk { /// <summary> /// Usability functions for <see cref="IMockFactory"/>. /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced)] public static class MockFactoryExtensions { /// <summary> ...
Test to verify that minimal message body can be redelivered via the delayed transport (serialization issue)
namespace MassTransit.Tests { using System; using System.Linq; using System.Threading.Tasks; using MassTransit.Serialization; using NUnit.Framework; using TestFramework; using TestFramework.Messages; [TestFixture] public class When_consuming_a_minimal_message_body : InMemor...
Remove dupes from list II
// https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ // Given a sorted linked list, delete all nodes that have duplicate numbers, // leaving only distinct numbers from the original list. // https://leetcode.com/submissions/detail/58844735/ // // Submission Details // 166 / 166 test cases ...
Add tests for converting RGB with HSV
namespace BigEgg.Tools.PowerMode.Tests.Utils { using System.Drawing; using System.Linq; using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; using BigEgg.Tools.PowerMode.Utils; public class ColorExtensionTest { [TestClass] public class HSVConvert ...
Copy Text objects to other layer and delete surce
//Synchronous template //----------------------------------------------------------------------------------- // PCB-Investigator Automation Script // Created on 30.03.2017 // Autor Guenther.Schindler // // Empty template to fill for synchronous script. //---------------------------------------------------------...
Implement betting and getting popular keywords
using System; using StackExchange.Redis; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; namespace CollapsedToto { [Prefix("/round")] public class RoundModule : BaseModule { private static ConnectionMultiplexer redis = null; private static IDatabase Database ...
Add benchmark for dependency injection.
/* using BenchmarkDotNet.Attributes; using Robust.Shared.IoC; namespace Content.Benchmarks { // To actually run this benchmark you'll have to make DependencyCollection public so it's accessible. public class DependencyInjectBenchmark { [Params(InjectMode.Reflection, InjectMode.DynamicMethod)] ...
Add texture cropping test case
// 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.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphi...
Add comment for OSX specific FileSystem test
// 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.Diagnostics; using System.Runtime.InteropServices; using Xunit; namespace System.IO.Tests { public...
// 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.Diagnostics; using System.Runtime.InteropServices; using Xunit; namespace System.IO.Tests { public...
Add unit tests for the SqlServerStorageEngine class
// Copyright 2015 Coinprism, Inc. // // 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 agree...
Change console URL for 1 code sample
// Download the twilio-csharp library from twilio.com/docs/csharp/install using System; using Twilio.Lookups; class Example { static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account const string accountSid = "{{ account_sid }}"; const string authToken = "{{ ...
// Download the twilio-csharp library from twilio.com/docs/csharp/install using System; using Twilio.Lookups; class Example { static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/console const string accountSid = "{{ account_sid }}"; const string authToken = "{{ auth_...
Add order item delete support
@model Orders.com.Web.MVC.ViewModels.OrderItemViewModel @{ ViewBag.Title = "Delete"; } <h2>Delete Item</h2> <h3>Are you sure you want to delete this?</h3> <div class="form-horizontal"> <div class="form-group"> <label class="control-label col-md-1">Category</label> <div class="col-md-10"> ...
Create a class that acts as a configuration node for cache providers
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Xml; using System.IO; using System.Configuration; using Nohros.Resources; namespace Nohros.Configuration { /// <summary> /// Contains configuration informations for cache providers. /// ...
Add a more specific GenericListModel to reduce the amount of code
using System.Collections; using System.Collections.Generic; using Xe.Tools.Wpf.Models; namespace OpenKh.Tools.Common.Models { public class MyGenericListModel<T> : GenericListModel<T>, IEnumerable<T> { public MyGenericListModel(IEnumerable<T> list) : base(list) { } public IEnum...
Add realtime multiplayer test scene
// 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.Game.Screens.Multi.Components; namespace osu.Game.Tests.Visual.RealtimeMultiplayer { public class TestSceneRealtimeMultiplayer : RealtimeMultiplayerTestSce...
Add tests for Get & AddToPayload
using Bugsnag.Payload; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace Bugsnag.Tests { public class PayloadExtensionsTests { [Theory] [MemberData(nameof(PayloadTestData))] public void AddToPayloadTests(Dictionary...
Add test case for TypeRegistry
using Htc.Vita.Core.Util; using Xunit; namespace Htc.Vita.Core.Tests { public class TypeRegistryTest { [Fact] public static void Default_0_RegisterDefault() { TypeRegistry.RegisterDefault<BaseClass, SubClass1>(); } [Fact] public static void Default_...
Create Global Supressions for CA warnings on THNETII.CommandLine.Hosting
 // 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. using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("R...
Add test coverage of login dialog
// 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.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Login;...
Add .net 4.5 compatibility shim classes
// ---------------------------------------------------- // THIS WHOLE File CAN GO AWAY WHEN WE TARGET 4.5 ONLY // ---------------------------------------------------- using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; namespace Octokit { [SuppressMessage("Microsoft....
Add view model factory interface
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PhotoLife.Factories { interface IViewModelFactory { } }
Add an expression interpretation bug test
using System; using System.Linq.Expressions; using Xunit; namespace ExpressionToCodeTest { public class ExpressionInterpretationBug { struct AStruct { public int AValue; } class SomethingMutable { public AStruct AStructField; ...
Add benchmarks for bindable binding
// 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 BenchmarkDotNet.Attributes; using osu.Framework.Bindables; namespace osu.Framework.Benchmarks { public class BenchmarkBindableInstantiation {...
Replace missing file lost during merge
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Orchard.Alias.Implementation.Holder; using Orchard.Alias.Implementation.Storage; namespace Orchard.Alias.Implementation.Updater { public interface IAliasHolderUpdater : IDependency { void Refresh(); } publi...
Add a static resources library
// Resources.cs // <copyright file="Resources.cs"> This code is protected under the MIT License. </copyright> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EnigmaUtilities { /// <summary> /// A static class with commonly used func...
Add namespace & type for experimental work
#region License and Terms // MoreLINQ - Extensions to LINQ to Objects // Copyright (c) 2018 Atif Aziz. 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:...
Add failing test for compiled queries with Includes
using Marten.Linq; using Marten.Services; using Marten.Services.Includes; using Marten.Testing.Documents; using Shouldly; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using Xunit; namespace Marten.Testing.Bugs { public class compiled_query_problem_...
Set up timer so that it can't start reducing while previous reduction is still in progress.
using System; namespace ZocMonLib.Service.Reduce { public class ReduceServiceRunner { private readonly ISystemLogger _logger; private System.Timers.Timer _timer; private readonly ISettings _settings; public ReduceServiceRunner(ISettings settings) { _logger =...
using System; namespace ZocMonLib.Service.Reduce { public class ReduceServiceRunner { private readonly ISystemLogger _logger; private System.Timers.Timer _timer; private readonly ISettings _settings; public ReduceServiceRunner(ISettings settings) { ...
Add test to cover `RegisterBlockHelper` readme example
using System.Collections.Generic; using Xunit; namespace HandlebarsDotNet.Test { public class ReadmeTests { [Fact] public void RegisterBlockHelper() { var handlebars = Handlebars.Create(); handlebars.RegisterHelper("StringEqualityBlockHelper", (output, options, c...
Add usage examples for double-checking doc examples.
using System; using System.Collections.Generic; using System.Text; using Xunit; using static Nito.ConnectedProperties.ConnectedProperty; namespace UnitTests { class UsageExamples { [Fact] public void SimpleUsage() { var obj = new object(); var nameProperty = Ge...
Add path.cs to source control
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chutes.Optimization.Entities { public class Path { LinkedList<Gamespace> _path = new LinkedList<Gamespace>(); public Path() { _path.C...
Add coin flipping command. Sometimes lands on it's side. No idea why!
using System; using System.Collections.Generic; using System.IO; using TwitchLib; using TwitchLib.TwitchClientClasses; using System.Net; namespace JefBot.Commands { internal class CoinPluginCommand : IPluginCommand { public string PluginName => "Coin"; public string Command => "coin"; ...
Add suport of nullable reference type attributes for lower TFM
#if !NETSTANDARD2_1 namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] seale...
Add the builder of DateRange
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace NBi.Core.Members.Ranges { internal class DateRangeBuilder : BaseBuilder { protected new DateRange Range { get { return (DateRange)base.R...
Fix incorrect copying of blending values.
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using OpenTK.Graphics.ES30; namespace osu.Framework.Graphics { public struct BlendingInfo { public BlendingFactorSrc Source; ...
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using OpenTK.Graphics.ES30; namespace osu.Framework.Graphics { public struct BlendingInfo { public BlendingFactorSrc Source; ...
Add tests for the BarLineGenerator
// 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.Linq; using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Objects;...
Create a supplier that supply elements continually(Stream).
using System; namespace Nohros { /// <summary> /// A implementation of the <see cref="ISupplier{T}"/> class that supply /// elements of type <typeparamref name="T"/> in a sequence. /// </summary> /// <typeparam name="T"> /// The type of objects supplied. /// </typeparam> public interface IS...
Add test scene for drawings screen
// 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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Game.Graphics.Cursor; using osu.Game.Tournament.Scr...