Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add examples and unit tests for comparing structs. | using System;
using System.Collections.Generic;
using System.Linq;
using Nito.Comparers;
using Nito.Comparers.Util;
using Xunit;
namespace UnitTests
{
public class ComparableBase_Struct_DefaultComparerUnitTests
{
private struct Person : IComparable<Person>, IEquatable<Person>, IComparable
{
... | |
Reorder list - off by one | // https://leetcode.com/problems/reorder-list/
//
// Given a singly linked list L: L0→L1→…→Ln-1→Ln,
// reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
//
// You must do this in-place without altering the nodes' values.
//
// For example,
// Given {1,2,3,4}, reorder it to {1,4,2,3}.
using System;
public class ListN... | |
Add unit test for compute max stack override. | using AsmResolver.DotNet.Builder;
using AsmResolver.DotNet.Code.Cil;
using AsmResolver.DotNet.Signatures;
using AsmResolver.PE.DotNet.Cil;
using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
using Xunit;
namespace AsmResolver.DotNet.Tests.Builder
{
public class CilMethodBodySerializerTest
{
[Theory]
... | |
Add RenderTreeBuilder extension methods for "prevent default" and "stop bubbling" | // 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 Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.RenderTree;
namespace Microsoft.AspNetCore.Components.Web
{
... | |
Add a TestCase for looong combos | // 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.Beatmaps;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public cl... | |
Fix comment on attribute ctor. bugid: 862 | using System;
namespace System.ComponentModel.DataAnnotations
{
/// <summary>
/// Specifies that a data field value must
/// fall within the specified range.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class StringLengthAttribute : ValidationAttribute
{
private int _... | using System;
namespace System.ComponentModel.DataAnnotations
{
/// <summary>
/// Specifies that a data field value must
/// fall within the specified range.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class StringLengthAttribute : ValidationAttribute
{
private int _... |
Select everything outside of pcb profile | //Synchronous template
//-----------------------------------------------------------------------------------
// PCB-Investigator Automation Script
// Created on 14.10.2015
// Autor Fabio Gruber
//
// Select all elements outside the board contour, e.g. to delete them.
//------------------------------------------... | |
Transform repeat rules into a tree | using System.Linq;
using slang.Lexing.Rules.Core;
using slang.Lexing.Trees.Nodes;
namespace slang.Lexing.Trees.Transformers
{
public static class RepeatRuleExtensions
{
public static Tree Transform (this Repeat rule)
{
var tree = rule.Value.Transform ();
var transitions... | |
Remove duplicates from sorted 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.
//
// For example,
// Given 1->2->3->3->4->4->5, return 1->2->5.
// Given 1->1->1->2->3, return 2->3.
//
//... | |
Add mock builder for CarsContextQuery | using System.Collections.Generic;
using System.Linq;
using PathFinder.Cars.DAL.Model;
using PathFinder.Cars.WebApi.Queries;
namespace CarsControllersTests
{
public class CarContextQueryMockBuilder
{
private readonly CarContextMock _fakeQuery;
public CarContextQueryMockBuilder()
{
... | |
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
// (... | |
Set Profil to fix Rectangle | //-----------------------------------------------------------------------------------
// PCB-Investigator Automation Script
// Created on 2014-04-24
// Autor support@easylogix.de
// www.pcb-investigator.com
// SDK online reference http://www.pcb-investigator.com/sites/default/files/documents/InterfaceDocumentation... | |
Refactor var in Session to be consistent with rest of the plugins | using System.Collections.Generic;
using Glimpse.AspNet.Extensions;
using Glimpse.AspNet.Model;
using Glimpse.Core.Extensibility;
namespace Glimpse.AspNet.SerializationConverter
{
public class SessionModelConverter : SerializationConverter<List<SessionModel>>
{
public override object Convert(List<Sessi... | using System.Collections.Generic;
using Glimpse.AspNet.Extensions;
using Glimpse.AspNet.Model;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Plugin.Assist;
namespace Glimpse.AspNet.SerializationConverter
{
public class SessionModelConverter : SerializationConverter<List<SessionModel>>
{
public ... |
Add unit tests for SingleDisposable. | using System;
using System.Threading.Tasks;
using Nito.AsyncEx;
using System.Linq;
using System.Threading;
using System.Diagnostics.CodeAnalysis;
using Xunit;
namespace UnitTests
{
public class SingleDisposableUnitTests
{
[Fact]
public void ConstructedWithNullContext_DisposeIsANoop()
{... | |
Update website and copyright year. | using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyProduct("Harbour.RedisSessionStateStore")]
[assembly: AssemblyCompany("http... | using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyProduct("Harbour.RedisSessionStateStore")]
[assembly: AssemblyCompany("http... |
Select start page by default instead of root | using System;
using N2.Web.UI.WebControls;
namespace N2.Edit
{
[ToolbarPlugin("", "tpPreview", "{url}", ToolbarArea.Preview, Targets.Preview, "~/Edit/Img/Ico/Png/eye.png", 0, ToolTip = "edit", GlobalResourceClassName = "Toolbar")]
[ControlPanelLink("cpAdminister", "~/edit/img/ico/png/application_side_tree.png"... | using System;
using N2.Web.UI.WebControls;
namespace N2.Edit
{
[ToolbarPlugin("", "tpPreview", "{url}", ToolbarArea.Preview, Targets.Preview, "~/Edit/Img/Ico/Png/eye.png", 0, ToolTip = "edit", GlobalResourceClassName = "Toolbar")]
[ControlPanelLink("cpAdminister", "~/edit/img/ico/png/application_side_tree.png"... |
Add NorthEurope to location enum for Data Factories | //
// Copyright (c) Microsoft and contributors. 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 requi... | //
// Copyright (c) Microsoft and contributors. 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 requi... |
Add test asserting reconnect works. | using System.Threading.Tasks;
using NUnit.Framework;
using Robust.Client.Console;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
namespace Content.IntegrationTests.Tests
{
[TestFixture]
public class ReconnectTest : ContentIntegrationTest
{
[Test]
public async Task Test()
... | |
Add 'tabs' and header with converter on main page | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Postolego.Converters {
public class TextDependentOnSelectedIndexConverter : IValueConverter {
public object Convert(object value, Type targetType, object... | |
Add an Rx-friendly HTTP downloader | using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Text;
namespace NSync.Core
{
public static class Http
{
/// <summary>
/// Download data from an HTTP URL and insert the result into the
... | |
Update lock to version 7.11 | @using System.Configuration;
@{
ViewBag.Title = "Login";
}
<div id="root" style="width: 280px; margin: 40px auto;">
</div>
@Html.AntiForgeryToken()
<script src="https://cdn.auth0.com/js/lock-7.9.min.js"></script>
<script>
if (!window.location.origin) {
window.location.origin = window.location.protocol... | @using System.Configuration;
@{
ViewBag.Title = "Login";
}
<div id="root" style="width: 280px; margin: 40px auto;">
</div>
@Html.AntiForgeryToken()
<script src="https://cdn.auth0.com/js/lock-7.11.min.js"></script>
<script>
if (!window.location.origin) {
window.location.origin = window.location.protoco... |
Add sorting order/layer comparison Also move comparer methods into a list | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using UnityEngine.EventSystems;
namespace HoloToolkit.Unity
{
public class RaycastResultComparer : IComparer<RaycastResult>
... | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using UnityEngine.EventSystems;
namespace HoloToolkit.Unity
{
public class RaycastResultComparer : IComparer<Ray... |
Add a default VS foregrounddispatcher | // 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.ComponentModel.Composition;
using Microsoft.VisualStudio.Shell;
namespace Microsoft.VisualStudio.LanguageServices.Razor
{
[Export(typ... | |
Create 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 ... | |
Remove error message giving away path location if not accessing from the local machine | namespace dotless.Core
{
using System.Web;
using System.Web.SessionState;
public class LessCssWithSessionHttpHandler : LessCssHttpHandler, IRequiresSessionState
{
}
public class LessCssHttpHandler : LessCssHttpHandlerBase, IHttpHandler
{
public void ProcessRequest(HttpContext ... | namespace dotless.Core
{
using System.Web;
using System.Web.SessionState;
public class LessCssWithSessionHttpHandler : LessCssHttpHandler, IRequiresSessionState
{
}
public class LessCssHttpHandler : LessCssHttpHandlerBase, IHttpHandler
{
public void ProcessRequest(HttpContext ... |
Add a sanity check for exported types | using System.Linq;
using NUnit.Framework;
using ZeroLog.Tests.Support;
namespace ZeroLog.Tests;
[TestFixture]
public class SanityChecks
{
[Test]
public void should_export_expected_types()
{
// This test prevents mistakenly adding public types in the future.
var publicTypes = new[]
... | |
Add missing file from code config branch | using System;
using System.Collections.Generic;
using System.Text;
namespace Spring.Objects.Factory.Parsing
{
public interface IProblemReporter
{
void Fatal(Problem problem);
void Warning(Problem problem);
void Error(Problem problem);
}
}
| |
Add simple snippet to get InformationalVersion | public static string GetProductVersion()
{
var attribute = (AssemblyVersionAttribute)Assembly
.GetExecutingAssembly()
.GetCustomAttributes( typeof(AssemblyVersionAttribute), true )
.Single();
return attribute.InformationalVersion;
} | |
Update WriteJSONTest to initialize TiledNavMesh with non-null parameter | #region License
/**
* Copyright (c) 2013-2014 Robert Rouhani <robert.rouhani@gmail.com> and other contributors (see CONTRIBUTORS file).
* Licensed under the MIT License - https://raw.github.com/Robmaister/SharpNav/master/LICENSE
*/
#endregion
using System;
using System.Collections;
using System.Collections.Gene... | #region License
/**
* Copyright (c) 2013-2014 Robert Rouhani <robert.rouhani@gmail.com> and other contributors (see CONTRIBUTORS file).
* Licensed under the MIT License - https://raw.github.com/Robmaister/SharpNav/master/LICENSE
*/
#endregion
using System;
using System.Collections;
using System.Collections.Gene... |
Add a test for TwoDigitYearMax to KoreanCalendar | // 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 Xunit;
namespace System.Globalization.Tests
{
public class KoreanCalendarTwoDigitYearMax
{
[F... | // 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 Xunit;
namespace System.Globalization.Tests
{
public class KoreanCalendarTwoDigitYearMax
{
[F... |
Extend the Rotorz Tile System api | // This set of methods extends the most excellent Rotorz api. I built this set because,
// while I love Rotorz, I find its method paramaters frustrating to use. Specifically,
// I tend to send x coordinates first in my params, followed by y coordinates; while
// Rotorz transposes this. It has lead to many crazy-making ... | |
Change properties to inherit from declarations. | using System;
using System.Collections.Generic;
namespace Cxxi
{
/// <summary>
/// Represents a C++ property.
/// </summary>
public class Property
{
public Property(string name, Declaration type)
{
Name = name;
Type = type;
}
public string Na... | using System;
using System.Collections.Generic;
namespace Cxxi
{
/// <summary>
/// Represents a C++ property.
/// </summary>
public class Property : Declaration
{
public Property(string name, Declaration type)
{
Name = name;
Type = type;
}
pu... |
Move sort class to new file |
namespace ContractsWindow
{
public enum contractSortClass
{
Difficulty = 1,
Expiration = 2,
Acceptance = 3,
Reward = 4,
Type = 5,
Planet = 6,
}
}
| |
Add regression test for the pattern of using DHO proxy in `LifetimeManagementContainer` | // 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 NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Fra... | |
Add a platform detection mechanism to use in tests | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
// TODO: This implementation is temporary until Environment.OSVersion is officially exposed,
// at which poin... | |
Add extension methods for logging timings | using Serilog;
namespace GitHub.Logging
{
public static class ILoggerExtensions
{
public static void Assert(this ILogger logger, bool condition, string messageTemplate)
{
if (!condition)
{
messageTemplate = "Assertion Failed: " + messageTemplate;
#pragma ... | using System;
using System.Globalization;
using System.Threading.Tasks;
using Serilog;
namespace GitHub.Logging
{
public static class ILoggerExtensions
{
public static void Assert(this ILogger logger, bool condition, string messageTemplate)
{
if (!condition)
{
... |
Add a Task extension to handle timeouts | using System;
using System.Threading;
using System.Threading.Tasks;
namespace CircuitBreaker.Net
{
// The following code is taken from "Crafting a Task.TimeoutAfter Method" post by Joe Hoag
// http://blogs.msdn.com/b/pfxteam/archive/2011/11/10/10235834.aspx
public static class TaskExtensions
{
... | |
Add sample class with implementation of IComparable<> | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Recipe.ClassAndGeneric
{
/// <summary>
/// Simple class that implements IComparable<>
/// </summary>
public class Square : IComparable<Square>
{
public Square()
... | |
Add class to auto-activate touch controls. | using UnityEngine;
using UnityEngine.Assertions;
[ExecuteInEditMode]
public class AutoEnableTouchControls : BaseBehaviour
{
private GameObject canvasGo;
private GameObject eventSystem;
void Start()
{
canvasGo = gameObject.transform.Find("Canvas").gameObject;
Assert.IsNotNull(canvasGo);
eventSystem = gameO... | |
Add an extension method to the worksheet | using OfficeOpenXml;
public static class WorksheetExtensions
{
public static string[,] ToStringArray(this ExcelWorksheet sheet)
{
string[,] answer = new string[sheet.Dimension.Rows, sheet.Dimension.Columns];
for (var rowNumber = 1; rowNumber <= sheet.Dimension.Rows; rowNumber++)
{
... | |
Add Console abstraction for test suites | using Internal.ReadLine.Abstractions;
using System;
namespace ReadLine.Tests.Abstractions
{
internal class Console2 : IConsole
{
public int CursorLeft => _cursorLeft;
public int CursorTop => _cursorTop;
public int BufferWidth => _bufferWidth;
public int BufferHeight => _buff... | |
Add test for changing data type (Thanks @prankaty ) | using ClosedXML.Excel;
using NUnit.Framework;
using System;
namespace ClosedXML_Tests.Excel.Cells
{
[TestFixture]
public class DataTypeTests
{
[Test]
public void ConvertNonNumericTextToNumberThrowsException()
{
using (var wb = new XLWorkbook())
{
... | |
Add basic benchmarks for Is and Class selectors. | using Avalonia.Controls;
using Avalonia.Styling;
using BenchmarkDotNet.Attributes;
namespace Avalonia.Benchmarks.Styling
{
[MemoryDiagnoser]
public class SelectorBenchmark
{
private readonly Control _notMatchingControl;
private readonly Calendar _matchingControl;
private readonly S... | |
Add type to represent range in a text file | using System;
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer
{
public class Range
{
public Position Start { get; }
public Position End { get; }
public Range(Position start, Position end)
{
if (start > end)
{
throw new ArgumentExcept... | |
Create audio source controller component | using UnityEngine;
using System.Collections;
namespace ATP.AnimationPathTools.AudioSourceControllerComponent {
public class AudioSourceController : MonoBehaviour {
private void Start() {
}
private void Update() {
}
}
}
| |
Add `RulesetStore` for use where realm is not present (ie. other projects) | // 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 osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Platform;
#nullable enable
names... | |
Fix for partial trust environments Assembly.GetExecutingAssembly() cannot be used in Partial trust environments Also linux type paths report file:// and not file:/// so substring(8) should not be used | using System;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Reflection;
namespace Simple.Data.Mysql
{
public static class MysqlConnectorHelper
{
private static DbProviderFactory _dbFactory;
private static DbProviderFactory DbFactory
{
... | using System;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Reflection;
namespace Simple.Data.Mysql
{
public static class MysqlConnectorHelper
{
private static DbProviderFactory _dbFactory;
private static DbProviderFactory DbFactory
{
... |
Fix errors in log caused by no prevalues beind selected. | using System;
using umbraco.DataLayer;
namespace umbraco.editorControls
{
/// <summary>
/// Summary description for cms.businesslogic.datatype.DefaultDataKeyValue.
/// </summary>
public class DefaultDataKeyValue : cms.businesslogic.datatype.DefaultData
{
public DefaultDataKeyValue(cms.businesslogic... | using System;
using umbraco.DataLayer;
namespace umbraco.editorControls
{
/// <summary>
/// Summary description for cms.businesslogic.datatype.DefaultDataKeyValue.
/// </summary>
public class DefaultDataKeyValue : cms.businesslogic.datatype.DefaultData
{
public DefaultDataKeyValue(cms.businesslogic... |
Add index only drawer node | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using SlimDX;
using SlimDX.Direct3D11;
using VVVV.PluginInterfaces.V2;
using VVVV.PluginInterfaces.V1;
using FeralTic.DX11;
using FeralTic.DX11.Resources;
namespace VVVV.DX11.Nodes
{
[... | |
Test invalid filter type handling. | using System;
using Xunit;
using Pingu.Filters;
namespace Pingu.Tests
{
public class FilterTests
{
[Fact]
public void Get_filter_throws_for_invalid_filter_type()
{
var arex = Assert.Throws<ArgumentOutOfRangeException>(() => DefaultFilters.GetFilterForType((FilterType)11));... | |
Add some basic tests for tags | using FluentAssertions;
using Xunit;
namespace Okanshi.Test
{
public class TagTest
{
[Fact]
public void Creating_a_new_tag_sets_the_correct_key()
{
var expectedKey = "key";
var tag = new Tag(expectedKey, "anything");
tag.Key.Should().Be(expectedKey)... | |
Mark Height Components with region transgression | //-----------------------------------------------------------------------------------
// PCB-Investigator Automation Script
// Created on 16.06.2016
// Autor Fabio.Gruber
//
// Mark all components in max height regions of drc_comp layer.
// This checks each cmp over the surfaces on relevant layer with drc_max_he... | |
Add new CoinView class for query coins | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using NBitcoin;
using WalletWasabi.Helpers;
using WalletWasabi.Models;
namespace WalletWasabi.Gui.Models
{
public class CoinsView : IEnumerable<SmartCoin>
{
private IEnumerable<SmartCoin> _coins;
public CoinsView(IEnume... | |
Implement unit tests for the StringPattern 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... | |
Convert to new Visual Studio project types | // 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("Style", "IDE... | |
Revert the Quickstart file which is deleted by mistake | /*
* Copyright (c) 2018 Google 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 agreed to ... | |
Add error handling to default template | @inherits UmbracoViewPage<BlockListModel>
@using Umbraco.Core.Models.Blocks
@{
if (Model?.Layout == null || !Model.Layout.Any()) { return; }
}
<div class="umb-block-list">
@foreach (var layout in Model.Layout)
{
if (layout?.Udi == null) { continue; }
var data = layout.Data;
... | @inherits UmbracoViewPage<BlockListModel>
@using Umbraco.Core.Models.Blocks
@{
if (Model?.Layout == null || !Model.Layout.Any()) { return; }
}
<div class="umb-block-list">
@foreach (var layout in Model.Layout)
{
if (layout?.Udi == null) { continue; }
var data = layout.Data;
... |
Set the course directory as Content (for MSBuild) | using System;
using System.Collections.Generic;
using System.Text;
namespace DotvvmAcademy.CourseFormat
{
public class MarkdownStepInfo
{
public string Path { get; }
public string Moniker { get; }
public string Name { get; }
public string CodeTaskPath { get; }
}
}
| |
Add file missed in bug fix 440109 | // ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// 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,... | |
Allow overriding default static files in theme | namespace Snow
{
using System;
using System.Collections.Generic;
using Nancy.Conventions;
using Nancy.ViewEngines;
public class SnowViewLocationConventions : IConvention
{
public static SnowSettings Settings { get; set; }
public void Initialise(NancyConventions conv... | namespace Snow
{
using System;
using System.Collections.Generic;
using Nancy.Conventions;
using Nancy.ViewEngines;
public class SnowViewLocationConventions : IConvention
{
public static SnowSettings Settings { get; set; }
public void Initialise(NancyConventions conv... |
Add pushconsumer wrap to donet | using System;
using System.Runtime.InteropServices;
namespace RocketMQ.Interop
{
public static class PushConsumerWrap
{
[DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CreatePushConsumer(string groupId);
[DllImpor... | |
Add testing for auto-restart behaviour | // 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.Containers;
using osu.Framework.Testing;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
usin... | |
Add visual-only execution mode toggle 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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Platform;
namespace osu.Fram... | |
Create a new diagram example | using Aspose.Diagram;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CSharp.ProgrammersGuide.Load_Save_Convert
{
public class CreateNewVisio
{
public static void Run()
{
//ExStart:CreateNewVisio
// The path... | |
Add test class with other attribute on method | using System.ComponentModel;
using System.Threading.Tasks;
using Refit;
interface IFooWithOtherAttribute
{
[Get("/")]
Task GetRoot();
[DisplayName("/")]
Task PostRoot();
}
| |
Annotate the test with ActiveIssue | // 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 Xunit;
namespace System.Data.SqlClient.Tests
{
public class SqlConnectionBasicTests
{
[Fac... | // 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 Xunit;
namespace System.Data.SqlClient.Tests
{
public class SqlConnectionBasicTests
{
[Fac... |
Add class to load client in private load context. | /*
Copyright 2020 Jeffrey Sharp
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS A... | |
Set AssemblyConfiguration attribute to a simple/default value. | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
... | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
... |
Add ISerializer impl. that uses JSON.NET | using System.IO;
using System.Text;
using log4net.ObjectRenderer;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace log4net.Util.Serializer
{
public class JsonDotNetSerializer : ISerializer
{
public RendererMap Map { get; set; }
public object Serialize(object obj)
{... | |
Add employee and manager as user roles | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PetAdoptionCRM.Models
{
public class EmployeeRole : IdentityRole
{
}
}
| |
Add unit test for GetSymmetricAlgorithm. | // 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.IdentityModel.Tokens;
using System.Security.Cryptography;
using Infrastructure.Common;
using Xunit... | |
Implement a class to query supported commands and get their instances. | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace SCPI
{
public class Commands
{
private Dictionary<string, ICommand> commands = new Dictionary<string, ICommand>();
/// <summary>
/// Creates a list of supported com... | |
Print pattern without a loop | // http://www.geeksforgeeks.org/print-a-pattern-without-using-any-loop/
//
//
// Print a pattern without using any loop
//
// Given a number n, print following pattern without using any loop.
//
// Input: n = 16
// Output: 16, 11, 6, 1, -4, 1, 6, 11, 16
//
// Input: n = 10
// Output: 10, 5, 0, 5, 10
//
using System;
c... | |
Add tests for RazorCompile target | // 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.IO;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
public class RazorCompi... | |
Create a tool for importing Whitebox *.dep files | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DotSpatial.Tools
{
class ImportWhiteboxRaster
{
}
}
| |
Add tests for Sha512 class | using System;
using NSec.Cryptography;
using Xunit;
namespace NSec.Tests.Algorithms
{
public static class Sha512Tests
{
public static readonly string HashOfEmpty = "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e";
... | |
Add unit tests for PointND. | namespace EOpt.Math.Tests
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
using EOpt.Math;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
[TestClass()]
public class PointNDTests
{
[TestMethod()]... | |
Switch over setup commands from using query class | using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using ZocMonLib;
namespace ZocMonLib
{
public class StorageCommandsSetupSqlServer : IStorageCommandsSetup
{
public virtual IEnumerable<ReduceLevel> SelectAllReduceLevels(IDbConnection conn)
{
retur... | using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using ZocMonLib;
namespace ZocMonLib
{
public class StorageCommandsSetupSqlServer : IStorageCommandsSetup
{
public virtual IEnumerable<ReduceLevel> SelectAllReduceLevels(IDbConnection conn)
{
const... |
Add missing file for ping command test. | using DiabloSpeech.Business.Twitch;
using DiabloSpeech.Business.Twitch.Processors;
using NUnit.Framework;
using tests.Twitch.Mocks;
namespace tests.Twitch
{
public class PingCommandProcessorTest
{
PingCommandProcessor processor;
TwitchConnectionMock connection;
TwitchMessageData Messa... | |
Add test covering ThreadedTaskScheduler shutdown | // 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.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Threading;
namespace osu.Framework.Tests.Threading
{
[TestFixture]
... | |
Add message type to blob trigger. | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.WindowsAzure.Storage.Blob;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Microsoft.Azure.WebJobs... | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.WindowsAzure.Storage.Blob;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Microsoft.Azure.WebJobs... |
Enable Get Element Property tests in Edge | using System;
using System.Collections.Generic;
using NUnit.Framework;
using System.Collections.ObjectModel;
using OpenQA.Selenium.Environment;
namespace OpenQA.Selenium
{
[TestFixture]
public class ElementPropertyTest : DriverTestFixture
{
[Test]
[IgnoreBrowser(Browser.Edge)]
[Igno... | using System;
using System.Collections.Generic;
using NUnit.Framework;
using System.Collections.ObjectModel;
using OpenQA.Selenium.Environment;
namespace OpenQA.Selenium
{
[TestFixture]
public class ElementPropertyTest : DriverTestFixture
{
[Test]
[IgnoreBrowser(Browser.Chrome, "Chrome does... |
Add osu!-specific enum for confine mouse mode | // 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.ComponentModel;
using osu.Framework.Input;
namespace osu.Game.Input
{
/// <summary>
/// Determines the situations in which the mouse cursor should b... | |
Change mobile client to use DefaultsController instead of GetwayController | using System.Threading.Tasks;
using ContosoMoments.Models;
using Xamarin.Forms;
using System;
namespace ContosoMoments
{
public class ResizeRequest
{
public string Id { get; set; }
public string BlobName { get; set; }
}
public class ActivityIndicatorScope : IDisposable
{
p... | using System.Threading.Tasks;
using ContosoMoments.Models;
using Xamarin.Forms;
using System;
namespace ContosoMoments
{
public class ResizeRequest
{
public string Id { get; set; }
public string BlobName { get; set; }
}
public class ActivityIndicatorScope : IDisposable
{
p... |
Implement unit test for boyer moore | using System;
namespace Algorithms.Strings.Search
{
public class BoyerMoore
{
private int[] right;
private const int R = 256;
private int M;
private string pat;
public BoyerMoore(string pat)
{
this.pat = pat;
right = new int[R];
... | |
Make the BuiltinThis test clearer | using System;
using JSIL;
public static class Program {
public static void Main (string[] args) {
var print = Builtins.Global["pr" + "int"];
if (print != null)
print("printed");
if (Builtins.Local["print"] != null)
Builtins.Local["print"]("printed again");
... | using System;
using JSIL;
public static class Program {
public static void Main (string[] args) {
const string pri = "pri";
string nt = "nt";
var p = Builtins.Global[pri + nt];
if (p != null)
p("printed");
if (Builtins.Local["p"] != null)
Builtins... |
Reduce the size of the keys in the generics migrator. This finally fixes the long standing issue of it failing to create the table on linux sometimes. Thanks go to Hippo_Finesmith for helping find the issue with this :). | /*
* Copyright (c) Contributors, http://aurora-sim.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 mus... | |
Add converter for old storable objects | using System;
using LazyStorage.Interfaces;
namespace LazyStorage.Xml
{
internal class StorableConverter<T> : IConverter<T> where T : IStorable<T>, IEquatable<T>, new()
{
public StorableObject GetStorableObject(T item)
{
return new StorableObject(item.GetStorageInfo());
}
... | |
Add benchmark coverage of logger | // 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.Logging;
using osu.Framework.Testing;
namespace osu.Framework.Benchmarks
{
[MemoryDiagnoser]
... | |
Add serviceable attribute to projects. | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
[assembly: AssemblyMetadata("Serviceable", "True")] | |
Add a partial view with form to reply to comments. | @using System.Threading.Tasks
@using CompetitionPlatform.Helpers
@model CompetitionPlatform.Models.ProjectViewModels.ProjectCommentPartialViewModel
<form asp-controller="ProjectDetails" asp-action="AddComment" enctype="multipart/form-data">
@if (ClaimsHelper.GetUser(User.Identity).Email != null)
{
<div... | |
Drop cassette config in for less integration | using Cassette;
using Cassette.Scripts;
using Cassette.Stylesheets;
namespace Exceptional.Web
{
/// <summary>
/// Configures the Cassette asset bundles for the web application.
/// </summary>
public class CassetteBundleConfiguration : IConfiguration<BundleCollection>
{
public voi... | |
Add file missed in build | // 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.
namespace ILCompiler
{
/// <summary>
/// Used to mark TypeDesc types that are not part of the core type sys... | |
Add NeutralResourcesLanguageAttribute to Channels lib | // 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.Resources;
[assembly:NeutralResourcesLanguage("en")]
| |
Add code for creating challenge from IdentityModel | #region Copyright
/* * * * * * * * * * * * * * * * * * * * * * * * * */
/* Carl Zeiss IMT (IZfM Dresden) */
/* Softwaresystem PiWeb */
/* (c) Carl Zeiss 2020 */
/* * * * * * * * * * * * * * * * * * * * * * * * * */
#endregion
namespace Zeiss.I... | |
Add new class to facilitate multi-threaded onion generation | using System;
using System.ComponentModel;
namespace Xpdm.PurpleOnion
{
class OnionGenerator
{
private readonly BackgroundWorker worker = new BackgroundWorker();
public OnionGenerator()
{
worker.DoWork += GenerateOnion;
worker.RunWorkerCompleted += RunWorkerCompleted;
}
public event EventHandle... | |
Add test to ensure ClaimsPrincipal serializes via MobileFormatter | //-----------------------------------------------------------------------
// <copyright file="ClaimsPrincipalTests.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>no summary</summary>
//-----------------------------------... | |
Add test scene for thumbnail component | // 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.Game.Beatmaps.Drawables.Cards;
using osu.Game.Overlays;
using osuTK;
names... | |
Add shader disposal test coverage | // 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 NUnit.Framework;
using osu.Framework.Graphics.Shaders;
using osu.Framework.IO.Stores;
using osu.Framework.Testing;
u... | |
Make sure changelist timer is enabled in watchdog, because Steamkit can get stuck between being connected and logging in | /*
* Copyright (c) 2013-2015, SteamDB. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
using System;
using System.Threading;
namespace SteamDatabaseBackend
{
public class Watchdog
{
public Watchdog()
{
... | /*
* Copyright (c) 2013-2015, SteamDB. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
using System;
using System.Threading;
namespace SteamDatabaseBackend
{
class Watchdog
{
public Watchdog()
{
new T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.