Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Test using a disposed plugin | namespace ServiceBus.AttachmentPlugin.Tests
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Azure.ServiceBus;
using Microsoft.Azure.ServiceBus.Core;
using Xunit;
public class When_reusing_plugin
{
[Fact]
... | |
Add class accidentally omitted from last commit | // Copyright (c) 2017 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
namespace LfMerge.Core.MongoConnector
{
/// Reimplementations of some PHP functions that turn out to be useful in the MongoConnector class
public static class PseudoPhp
{
/... | |
Add benchmark for stream extensions | // 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.IO;
using BenchmarkDotNet.Attributes;
using osu.Framework.Extensions;
namespace osu.Framework.Benchmarks
{
[MemoryDiagnoser]
public c... | |
Add add Michelin wmts sample | using System.Linq;
using System.Net.Http;
using BruTile.Wmts;
using Mapsui.Layers;
using Mapsui.UI;
namespace Mapsui.Samples.Common.Maps
{
public class WmtsMichelinSample : ISample
{
public string Name => "5 WMTS Michelin";
public string Category => "Data";
public void Setup(IMapContr... | |
Remove duplicates from sorted array II | // https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/
//
// Follow up for "Remove Duplicates":
// What if duplicates are allowed at most twice?
//
// For example,
// Given sorted array nums = [1,1,1,2,2,3],
//
// Your function should return length = 5,
// with the first five elements of ... | |
Define common Complex dialog interface | using System;
using System.Collections.Generic;
using System.Text;
namespace IronAHK.Rusty
{
interface IComplexDialoge
{
string MainText { get; set; }
string Subtext { get; set; }
string Title { get; set; }
#region Form
//DialogResult ShowDialog();
void Show()... | |
Add separate test for stateful multiplayer client | // 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.Testing;
using osu.Game.Tests.Visual.Multiplayer;
using osu.Game.Users;
namespace osu.Game.Tests.OnlinePlay
{
[HeadlessTes... | |
Implement tests for Commands interface, tests include lazy loading and "not supported command" -test. | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
namespace SCPI.Tests
{
public class Commands_Tests
{
[Fact]
public void HasSupportedCommands()
{
// Arrange
var commands = new Commands();
// Act
... | |
Add test coverage of TransactionalCommitComponent | // 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.Game.Screens.Edit;
namespace osu.Game.Tests.Editing
{
[TestFixture]
public class TransactionalCommitComponentTest
... | |
Fix using portable directory separator character | using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.DependencyInjection;
using IdentityServer3.Core.Configuration;
using IdentityServer.Configuration;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.Extensions.... | using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.DependencyInjection;
using IdentityServer3.Core.Configuration;
using IdentityServer.Configuration;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.Extensions.... |
Add interface for a migration | using System.Threading.Tasks;
namespace RapidCore.Migration
{
/// <summary>
/// Defines a migration
/// </summary>
public interface IMigration
{
/// <summary>
/// Code that is run when upgrading the environment
/// </summary>
Task UpgradeAsync(IMigrationContext cont... | |
Update the l\paths in the server side of the resource | using System;
using System.Collections.Generic;
namespace Glimpse.Core2.Framework
{
public class GlimpseMetadata
{
public GlimpseMetadata()
{
plugins = new Dictionary<string, PluginMetadata>();
}
public string version{ get; set; }
public IDictionary<string,P... | using System;
using System.Collections.Generic;
namespace Glimpse.Core2.Framework
{
public class GlimpseMetadata
{
public GlimpseMetadata()
{
plugins = new Dictionary<string, PluginMetadata>();
//TODO: this is really bad... Nik needs to work on how we want to do this. V... |
Use this instead of LocaleType | using System;
using System.Data;
using System.Globalization;
namespace NHibernate.Type {
/// <summary>
/// CultureInfoType.
/// </summary>
public class CultureInfoType : ImmutableType, ILiteralType {
public override object Get(IDataReader rs, string name) {
string str = (string) NHibernate.String.Get(rs, na... | |
Add support for UIViews in section headers and footers. | using System;
using System.Drawing;
using System.Linq;
using MonoTouch.UIKit;
using MonoTouch.Dialog;
namespace Sample
{
public partial class AppDelegate
{
public void DemoHeadersFooters ()
{
var section = new Section () {
HeaderView = new UIImageView (UIImage.FromFile ("caltemplate.png")),
FooterVi... | |
Add Orchard.Tags.TagsCloud "no data" message | @using Orchard.Tags.Models
<ul class="tag-cloud">
@foreach (TagCount tagCount in Model.TagCounts) {
<li class="tag-cloud-tag tag-cloud-tag-@tagCount.Bucket">
@Html.ActionLink(tagCount.TagName, "Search", "Home", new {
area = "Orchard.Tags",
tagName = tagCount.TagName
... | @using Orchard.Tags.Models
<ul class="tag-cloud">
@if (((IEnumerable<object>)Model.TagCounts).Any()) {
foreach (TagCount tagCount in Model.TagCounts) {
<li class="tag-cloud-tag tag-cloud-tag-@tagCount.Bucket">
@Html.ActionLink(tagCount.TagName, "Search", "Home", new {
... |
Fix the solution not building after a fresh clone. | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("The Git Development Community")]
[assembly: AssemblyCopyright("Copyright © 2009 The GitSharp Team")]
[assembly: ComVisible(false)]
#if DEBUG
[assembly: AssemblyConfiguration("Deb... | |
Add class to relay progress reporting For use whenever directly implementing IReportProgress is impossible | using System;
using System.Collections.Generic;
using System.Text;
namespace SkyEditor.Core.Utilities
{
/// <summary>
/// A basic implementation of <see cref="IReportProgress"/> that can be used to relay progress reporting when a function's parent class cannot implement this interface.
/// </summary>
... | |
Remove colour properties and rely on parent | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
namespace osu.Framework.Graphics.S... | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
namespace osu.Framework.Graphics.S... |
Add missing new test board target class | using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SignTestInterface;
using winusbdotnet;
namespace SignControl
{
class TargetTestBoard : ISignTarget
{
public TargetTestBoard()
{
TestBoard... | |
Add new tests for Unified Label | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CocosSharp;
namespace tests
{
public class LabelFNTColorAndOpacity : AtlasDemoNew
{
float m_time;
CCLabel label1, label2, label3;
public LabelFNTColorAndOpacity()
{
m_time = 0;
... | |
Add test for Ignore attribute | using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using SQLite.Net.Attributes;
#if __WIN32__
using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32;
#elif WINDOWS_PHONE
using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8;
#elif __WINRT__
using SQL... | |
Add a docs module to the sample project. |
using Mango;
using Mango.Templates.Minge;
namespace MangoProject {
public class Docs : MangoModule {
public static void GettingStarted (MangoContext context)
{
}
public static void Api (MangoContext context)
{
}
}
}
| |
Add example source code for Sense Hat connecting to Azure IoT Hub. | using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace DemoSenseHat
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summar... | |
Use two newlines in exception message to better match Power Assert.NET | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
namespace ExpressionToCodeLib {
public static class PAssert {
public static void IsTrue(Expression<Func<bool>> assertion) {
That(assertion,"PAssert.IsTrue failed for:");
}
public s... | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
namespace ExpressionToCodeLib {
public static class PAssert {
public static void IsTrue(Expression<Func<bool>> assertion) {
That(assertion,"PAssert.IsTrue failed for:");
}
public s... |
Fix off by one error. | using System;
using System.Collections.Generic;
using System.Linq;
namespace csmacnz.Coveralls
{
public class CoverageFileBuilder
{
private readonly string _filePath;
private readonly Dictionary<int,int> _coverage = new Dictionary<int, int>();
public CoverageFileBuilder(string filePat... | using System;
using System.Collections.Generic;
using System.Linq;
namespace csmacnz.Coveralls
{
public class CoverageFileBuilder
{
private readonly string _filePath;
private readonly Dictionary<int,int> _coverage = new Dictionary<int, int>();
public CoverageFileBuilder(string filePat... |
Add test to make sure the algorithm is passed down in time | // 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.Allocation;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.Mania.O... | |
Add google-cloud-resource-prefix header for Datastore calls | // Copyright 2016, Google Inc. 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 applicab... | |
Add tool to display all external dependencies, with versions | // Copyright 2020 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | |
Add proof of concept components list | // 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.Diagnostics;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Gr... | |
Test case for store (no-GC) value type to static field | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
struct TestValue
{
public int a;
public short b;
public long c;
}
// This test stores a primitive (no-GC fields) value type to a static field
//... | |
Define a math class in the standard library | namespace System
{
/// <summary>
/// Defines common mathematical functions and operations.
/// </summary>
public static class Math
{
public const double PI = 3.14159265358979;
}
} | |
Add models for User feedback. | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using CompetitionPlatform.Data.AzureRepositories.Users;
namespace CompetitionPlatform.Models
{
public class FeedbackViewModel : IUserFeedbackData
{
public string Email { get; set; }
[Required]
... | |
Change assembly version to 1.9.0.0 | //
// 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 la... | //
// 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 la... |
Add event args for product rating | using System;
namespace ZobShop.ModelViewPresenter.Product.Details.RateProduct
{
public class RateProductEventArgs : EventArgs
{
public RateProductEventArgs(int rating, string content, int productId, string authorId)
{
this.Rating = rating;
this.Content = content;
... | |
Add a compilation root as a container for individual compilation units created by parsing each file. | using System.Collections.Generic;
namespace slang.Compilation
{
public class CompilationRoot
{
public CompilationRoot (CompilationMetadata metadata)
{
CompilationUnits = new List<CompilationUnit> ();
Metadata = metadata;
}
public List<CompilationUnit> C... | |
Add some tests for KeyboardDevice. | using Avalonia.Input.Raw;
using Avalonia.Interactivity;
using Moq;
using Xunit;
namespace Avalonia.Input.UnitTests
{
public class KeyboardDeviceTests
{
[Fact]
public void Keypresses_Should_Be_Sent_To_Root_If_No_Focused_Element()
{
var target = new KeyboardDevice();
... | |
Add empty viewer for .so and .dylib files | using System.Collections.Generic;
using System.Windows.Controls;
using NuGetPackageExplorer.Types;
namespace PackageExplorer
{
[PackageContentViewerMetadata(100, ".so", ".dylib")]
internal class NativeLibraryFileViewer : IPackageContentViewer
{
public object GetView(IPackageContent selectedFile, I... | |
Add a lint rule that checks for correctness of view definitions. | using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Dapper;
using SJP.Schematic.Core;
namespace SJP.Schematic.Lint.Rules
{
public class InvalidViewDefinitionRule : Rule
{
public InvalidViewDefinitionRule(IDbConnection connection, RuleLevel level)
: b... | |
Add some query unit test | using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Text.RegularExpressions;
using LiteDB.Engine;
namespace LiteDB.Tests.... | |
Fix the issues with the persistentId and vessels dissapearing, etc | using Harmony;
using LmpCommon.Enums;
// ReSharper disable All
namespace LmpClient.Harmony
{
/// <summary>
/// This harmony patch is intended to always assign a persistentID and NEVER use the persistent id of the .craft file
/// </summary>
[HarmonyPatch(typeof(ShipConstruct))]
[HarmonyPatch("LoadS... | |
Make movement better, still not the best | namespace Engine
{
public class Vector
{
public readonly int _x;
public readonly int _y;
public Vector(int x, int y)
{
_x = x;
_y = y;
}
}
}
| |
Add tests for ITraktHttpRequest interface. | namespace TraktApiSharp.Tests.Experimental.Requests.Interfaces
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using System.Net.Http;
using TraktApiSharp.Experimental.Requests.Interfaces;
[TestClass]
public class ITraktHttpRequestTests
{... | |
Add test coverage of editor sample playback | // 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.Audio;
using osu.Framework.Testing;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu... | |
Copy of other project to get started. | 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: AssemblyTi... | |
Add use of tag-helpers instead of razor elements. Remove useless displayfor. | @model eShopWeb.ViewModels.PaginationInfo
<div class="esh-pager">
<div class="container">
<article class="esh-pager-wrapper row">
<nav>
<a class="esh-pager-item esh-pager-item--navigable @Model.Previous"
id="Previous"
href="@Url.Actio... | @model eShopWeb.ViewModels.PaginationInfo
<div class="esh-pager">
<div class="container">
<article class="esh-pager-wrapper row">
<nav>
<a class="esh-pager-item esh-pager-item--navigable @Model.Previous"
id="Previous"
... |
Add Unit Test for Report Training Provider Command Handler | using MediatR;
using Moq;
using NServiceBus;
using NUnit.Framework;
using SFA.DAS.EmployerAccounts.Commands.ReportTrainingProvider;
using SFA.DAS.EmployerAccounts.Configuration;
using SFA.DAS.NLog.Logger;
using SFA.DAS.Notifications.Messages.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
... | |
Add example for storing a private key in a file | using System;
using NSec.Cryptography;
using System.Collections.Generic;
using Xunit;
namespace NSec.Tests.Examples
{
public static class ExportImport
{
[Fact]
public static void ExportImportNSecPrivateKey()
{
// fake System.IO.File
var File = new Dictionary<stri... | |
Add abstract hit object application 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 System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Ga... | |
Change color of components to highlight them. | //ASynchronous template
//-----------------------------------------------------------------------------------
// PCB-Investigator Automation Script
// Created on 01.03.2016
// Autor support@easylogix.de
// www.pcb-investigator.com
// SDK online reference http://www.pcb-investigator.com/sites/default/files/documen... | |
Add NStoolbarItem.cs which now supports an Activated event | //
// NSToolbarItem.cs: Support for the NSToolbarItem class
//
// Author:
// Johan Hammar
//
using System;
using MonoMac.ObjCRuntime;
using MonoMac.Foundation;
namespace MonoMac.AppKit {
public partial class NSToolbarItem {
public event EventHandler Activated {
add {
Target = ActionDispatcher.SetupActi... | |
Fix missing files for release 3.7.4.2704 | namespace Patagames.Pdf.Net.Controls.WinForms
{
/// <summary>
/// Represents the scaling options of the page for printing
/// </summary>
public enum PrintSizeMode
{
/// <summary>
/// Fit page
/// </summary>
Fit,
/// <summary>
/// Actual size
... | |
Add base implementation for agent bus | using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reflection;
namespace Glimpse.Agent
{
public class DefaultMessageAgentBus : IMessageAgentBus
{
private readonly ISubject<IMessage> _subject;
// TODO: Review if we care abo... | |
Add a Player test scene that uses a legacy skin | // 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.Audio;
using osu.Framework.IO.Stores;
using osu.Game.Skinning;
using osu.Game.Tests.Visual;
na... | |
Add snippets for Offset type | // Copyright 2018 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using NUnit.Framework;
using System;
namespace NodaTime.Demo
{
public class OffsetDemo
{
[Test]
public void ConstructionFromHour... | |
Add Maverick Sevmont as author | 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 MaverickSevmont : IAmACommunityMember
{
public string FirstName => "Maverick";
... | |
Add RFC 7693 test vectors | using System;
using NSec.Cryptography;
using Xunit;
namespace NSec.Tests.Rfc
{
public static class Blake2Tests
{
public static readonly TheoryData<string, string> Rfc7693TestVectors = new TheoryData<string, string>
{
{ "616263", "ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12b... | |
Test to verify type name handling on newtonsoft using additional converter | namespace MassTransit.Tests.Serialization
{
using System;
using System.Linq;
using System.Threading.Tasks;
using MassTransit.Testing;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using NUnit.Framework;
[TestFixture]
public class When_using_type_name_handli... | |
Remove dupes, keep lexicographic order, take 1 - wrong | // http://careercup.com/question?id=5758790009880576
//
// Given a string with lowercase chars, delete the repeated
// letters and only leave one but with the optimal
// lexicographic order
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
static class Program
{
static String D... | |
Use this script to test the physics | using UnityEngine;
public class NudgeMe : MonoBehaviour {
public float xDir = 1000;
public float yDir = 1000;
// Update is called once per frame
void Update () {
if(Input.GetKey (KeyCode.Space)){
this.gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(xDir,yDir));
}
}
}
| |
Make the sample have good coding :-) | // mcs -pkg:gtkhtml-sharp -pkg:gtk-sharp gtk-html-sample.cs
using Gtk;
using System;
using System.IO;
class HTMLSample {
static int Main (string [] args)
{
HTML html;
Window win;
Application.Init ();
html = new HTML ();
win = new Window ("Test");
win.Add (html);
HTMLStream s = html.Begin ("text/html");... | // mcs -pkg:gtkhtml-sharp -pkg:gtk-sharp gtk-html-sample.cs
using Gtk;
using System;
using System.IO;
class HTMLSample {
static int Main (string [] args)
{
HTML html;
Window win;
Application.Init ();
html = new HTML ();
win = new Window ("Test");
win.Add (html);
HTMLStream s = html.Begin ("text/html");... |
Call Dispose on the messageConsumer and add a Guid to the message payload. | using System;
using FluentAssertions;
using Paramore.Brighter.MessagingGateway.Kafka;
using Xunit;
namespace Paramore.Brighter.Tests.MessagingGateway.Kafka
{
[Trait("Category", "KAFKA")]
public class KafkaMessageProducerSendTests : IDisposable
{
private const string QueueName = "test";
pri... | |
Add util classes to deal with specific claims. | using A2BBCommon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace A2BBAPI.Utils
{
public static class ClaimsUtils
{
#region Nested classes
/// <summary>
/// Holder for authorized user claims.
... | |
Add missing tests for write lock | using Xunit;
namespace RdbmsEventStore.Tests
{
public class WriteLockTests
{
[Fact]
public void SameIdCannotEnterLockSimultaneously()
{
var mutex = new WriteLock<int>();
var lock1 = mutex.Aquire(1);
var lock2 = mutex.Aquire(1);
Assert.T... | |
Move directions and orientations into global enums | public enum Side : byte { Right, Left, Top, Bottom };
public enum Position : byte { TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight } | |
Add placeholder test to avoid build warnings | // Copyright 2021 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | |
Add Servant Controller with retrieval and creation endpoints | using Microsoft.AspNetCore.Mvc;
using StoryGenerator.Domain;
using StoryGenerator.Persistance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace StoryGenerator.Controllers
{
[Route("api/servants")]
public class ServantController : Controller
{
... | |
Add a test for fruit randomness | // 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.Bindables;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Tests.Visual;... | |
Add tests for enumerable formatting ComplexObjectToPseudoCode | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using Xunit;
namespace ExpressionToCodeTest
{
public class EnumerableFormattingTest
{
[Fact]
public void ShortArraysRenderedCompletely() {... | |
Add extension search method for game object collection. | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Infusion.LegacyApi
{
public static class GameObjectCollectionExtensions
{
public static IEnumerable<GameObject> OfType(this IEnumerable<GameObject> objects, ModelId type)
=> objects.Where(o => o... | |
Add new attribute for authorization. | using System;
using Bibliotheca.Server.Mvc.Middleware.Authorization.SecureTokenAuthentication;
using Bibliotheca.Server.Mvc.Middleware.Authorization.UserTokenAuthentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
namespace Bibliotheca.Server.Mvc.Middleware.Author... | |
Add custom listbox item class | using System.Windows.Controls;
using System.Windows.Forms;
namespace food_tracker {
public class FoodBoxItem : ListBoxItem {
public int calories { get; set; }
public int fats { get; set; }
public int saturatedFat { get; set; }
public int carbohydrates { get; set; }
public int sugar { get; set; }
public ... | |
Define the log levels supported by the abstract logging API. | using System;
using System.Collections.Generic;
using System.Text;
namespace Nohros.Logging
{
/// <summary>
/// The supported logging levels. Not all loggin libraries support all the levels and when is
/// the case the related <see cref="ILogger"/> object will always return false for the
/// I... | |
Add dedicated class for listing application credits | using System.Collections.Generic;
namespace ShopifySharp.Filters
{
public class ApplicationCreditListFilter : ListFilter
{
public string Fields { get; set; }
public override IEnumerable<KeyValuePair<string, object>> ToQueryParameters()
{
return base.ToQueryParameters();
... | |
Add basic structure for HSV colour picker part | // 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.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
namespace osu.Framework.Graphics.UserInterface
{
/// <su... | |
Add car move event arguments | // CarMovedEventArgs.cs
// <copyright file="CarMovedEventArgs.cs"> This code is protected under the MIT License. </copyright>
namespace Tron.EventArgs
{
/// <summary>
/// The event arguments for when the timer changes.
/// </summary>
public class CarMovedEventArgs : System.EventArgs
{
/// <... | |
Add Html extension method for Kendo grid. | namespace SupportMe.Web.Infrastructure.HtmlHelpers
{
using System;
using System.Linq.Expressions;
using System.Web.Mvc;
using Kendo.Mvc.UI;
using Kendo.Mvc.UI.Fluent;
public static class KendoHelpers
{
public static GridBuilder<T> FullFeaturedGrid<T>(
this HtmlHelper h... | |
Add an interface for scrubbing rollbar data. | using Valetude.Rollbar;
namespace Nancy.Rollbar.Api {
public interface IRollbarDataScrubber{
RollbarData ScrubRollbarData(RollbarData data);
}
}
| |
Convert a MusicBrainz date into a DateTime object | /* -*- Mode: csharp; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: t -*- */
/***************************************************************************
* Utilities.cs
*
* Copyright (C) 2005 Novell
* Written by Aaron Bockover (aaron@aaronbock.net)
***********************************************************... | |
Add initial page permission enums. | using System;
namespace MitternachtWeb.Models {
[Flags]
public enum BotPagePermissions {
None = 0b00,
ReadBotConfig = 0b01,
WriteBotConfig = 0b11,
}
[Flags]
public enum GuildPagePermissions {
None = 0b_0000_0000,
ReadGuildConfig = 0b_0000_0001,
WriteGuildConfig = 0b_0000_0011... | |
Add unit test for strongly connected components. |
namespace CSparse.Tests.Ordering
{
using CSparse.Double;
using CSparse.Ordering;
using NUnit.Framework;
using System;
public class TestStronglyConnectedComponents
{
[Test]
public void TestScc()
{
// https://en.wikipedia.org/wiki/Strongly_connected_component... | |
Add more SDL2 native functions | // 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.Numerics;
using System.Runtime.InteropServices;
using osu.Framework.Graphics;
using Veldrid.Sdl2;
// ReSharper disable InconsistentNaming
namespace osu.Fra... | |
Add command line project loading | using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using Confuser.Core.Project;
using ConfuserEx.ViewModel;
namespace ConfuserEx {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
va... | using System;
using System.ComponentModel;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Xml;
using Confuser.Core.Project;
using ConfuserEx.ViewModel;
namespace ConfuserEx {
public partial class MainWindow : Window {
public MainWindow()... |
Embed assembly info and version | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("https://github.com/thekid/inotify-win")]
[assembly: AssemblyDescription("A port of the inotifywait tool for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Timm ... | |
Add notes on the alert model | namespace BatteryCommander.Web.Models
{
public class Alert
{
// Id
// SentAt
// Recipients - IDs? - Pull Phone, Email from Soldier entity
// Format - SMS? Email? Phone?
// Message / Content
// Status - Open, Closed -- Only one open at a time, all responses w... | |
Add tests for Project Resources. | using System.Collections.Generic;
using DigitalOcean.API.Clients;
using DigitalOcean.API.Http;
using DigitalOcean.API.Models.Requests;
using DigitalOcean.API.Models.Responses;
using NSubstitute;
using RestSharp;
using Xunit;
namespace DigitalOcean.API.Tests.Clients {
public class ProjectResourcesClientTest {
... | |
Add EventStore implementation of IEventStore. | using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using EventStore.ClientAPI;
namespace Edument.CQRS
{
// An implementation of IEventStore in terms of EventStore, available from
// h... | |
Add a unit test for the new reserve-whitespace behavior | //----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentat... | |
Fix for FAR in sample app | using System;
using System.Collections.Generic;
using Caliburn.Micro;
using CM.HelloUniversal.Views;
using CM.HelloUniversal.ViewModels;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml.Controls;
namespace CM.HelloUniversal
{
public sealed partial class App
{
private WinRTContainer con... | using System;
using System.Collections.Generic;
using System.Diagnostics;
using Caliburn.Micro;
using CM.HelloUniversal.Views;
using CM.HelloUniversal.ViewModels;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml.Controls;
namespace CM.HelloUniversal
{
public sealed partial class App
{
... |
Add basic support for outputing on the fly updates | using System;
using NUnit.Framework.Api;
using System.Xml.Linq;
using System.IO;
namespace GuiUnit
{
public class XmlTestListener : ITestListener
{
TextWriter Writer {
get; set;
}
public XmlTestListener (TextWriter writer)
{
Writer = writer;
}
public void TestStarted (ITest test)
{
if (test.... | |
Make metadata accessible without reflection | #region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to you under the Apache License, Version 2.0
// (... | |
Add simple step which allow using delegates for defining steps | using System;
using System.Threading.Tasks;
using NCrawler.Interfaces;
namespace NCrawler
{
/// <summary>
/// Implementation of pipeline steps which allow steps definition using simple functions
/// </summary>
public class SimpleStep : IPipelineStep
{
private Func<ICrawler, PropertyBag, Ta... | |
Add zone marker to fix exceptions in inspectcode | using JetBrains.Application.BuildScript.Application.Zones;
using JetBrains.ReSharper.Feature.Services.ExternalSources;
namespace JetBrains.ReSharper.Plugins.Unity.Feature.Services.ExternalSources
{
[ZoneMarker]
public class ZoneMarker : IRequire<ExternalSourcesZone>
{
}
} | |
Add Command to Edit Profiles | using CLImber;
using SetIPLib;
using System;
using System.Linq;
using System.Net;
namespace SetIPCLI
{
[CommandClass("edit", ShortDescription = "Updates a profile with the specified information. Updated info is specified using options: --ip=xxx.xxx.xxx.xxx")]
class EditProfile
{
private Profile _e... | |
Add class for David OBrien | 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 DavidOBrien : IFilterMyBlogPosts, IAmAMicrosoftMVP
{
public string FirstName => "David";
p... | |
Use a different generic type variable name that does not conflict with the parent one. | using System.Collections.Generic;
using System.Linq;
using CppSharp.Passes;
namespace CppSharp
{
/// <summary>
/// This class is used to build passes that will be run against the AST
/// that comes from C++.
/// </summary>
public class PassBuilder<T>
{
public List<T> Passes { get; priv... | using System.Collections.Generic;
using System.Linq;
using CppSharp.Passes;
namespace CppSharp
{
/// <summary>
/// This class is used to build passes that will be run against the AST
/// that comes from C++.
/// </summary>
public class PassBuilder<T>
{
public List<T> Passes { get; priv... |
Test was added for ExceptionDescription | namespace Skeleton.Web.Tests.Conventions.Responses
{
using System;
using Web.Conventions.Responses;
using Xunit;
public class ExceptionDescriptionTests
{
[Fact]
public void ShouldCollectInformation()
{
// Given
const string message = "<Message>";
... | |
Set root view controller for window | using System;
using CoreGraphics;
using UIKit;
using Foundation;
namespace TableEditing
{
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
#region -= main =-
public static void Main (string[] args)
{
try {
UIApplication.Main (args, null, "AppDelegate");
} catch (Excepti... | using System;
using CoreGraphics;
using UIKit;
using Foundation;
namespace TableEditing
{
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
#region -= main =-
public static void Main (string[] args)
{
try {
UIApplication.Main (args, null, "AppDelegate");
} catch (Excepti... |
Use "silent" install (no prompts) when running optional auto apply update | using Certify.Locales;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace Certify.UI.Utils
{
public class UpdateCheckUtils
{
public async Task<Models.UpdateCheck> UpdateWithDownload()
{
Mouse.OverrideCursor = Cursors.Wait;
var upda... | using Certify.Locales;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace Certify.UI.Utils
{
public class UpdateCheckUtils
{
public async Task<Models.UpdateCheck> UpdateWithDownload()
{
Mouse.OverrideCursor = Cursors.Wait;
var upda... |
Fix issue with persisting DateTime | using System;
namespace Tellurium.VisualAssertions.Screenshots.Utils
{
static class DateTimeExtensions
{
public static DateTime TrimToMiliseconds(this DateTime dateTime)
{
return Trim(dateTime, TimeSpan.TicksPerMillisecond);
}
static DateTime Trim(DateTime date, lo... | |
Add test to verify library class visability | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Stranne.BooliLib.Models;
using Xunit;
namespace Stranne.BooliLib.Tests
{
public class LibraryVisabilityTest
{
private readonly IEnumerable<Type> _publicClasses = new List<Type>
{
typeo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.