This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
namespace ModelBuilderInTestingExample; | |
public sealed class ModelBuilder<T> where T : class | |
{ | |
private readonly Dictionary<string, object?> _propertiesAssignedUsingSet = new Dictionary<string, object?>(StringComparer.OrdinalIgnoreCase); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UserSettings><ApplicationIdentity version="17.0"/><ToolsOptions><ToolsOptionsCategory name="Environment" RegisteredName="Environment"/></ToolsOptions><Category name="Environment_Group" RegisteredName="Environment_Group"><Category name="Environment_FontsAndColors" Category="{1EDA5DD4-927A-43a7-810E-7FD247D0DA1D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_FontsAndColors" PackageName="Visual Studio Environment Package"><PropertyValue name="Version">2</PropertyValue><FontsAndColors Version="2.0"><Theme Id="{1DED0138-47CE-435E-84EF-9EC1F439B749}"/><Categories><Category GUID="{FA937F7B-C0D2-46B8-9F10-A7A92642B384}" FontIsDefault="Yes"><Items><Item Name="Artboard Background" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/></Items></Category><Category GUID="{58E96763-1D3B-4E05-B6BA-FF7115FD0B7B}" FontName="Fira Code" FontSize="10" CharSet="1" FontIsDefault="No"><Items><Item Name="Plain Text" Foreground="0x00DCDCDC" Background="0x00191919" BoldFont="No"/></Items></Cat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 1. The local variable "schema" in the Main() method should be called xmlSchema | |
* 2. The method GetSchemaDocumentFromFile() should be called GetXmlSchemaFromFile() | |
* 3. There should be only one argument to method GetPpapiSchemaDocumentFromFile() and it should be called schemaFilePathAndName. | |
* There is no need for this method to have to know what applicationRootFolder means and how to constructor a full file path | |
* and name ofthe file it needs. The caller should be responsible for that. | |
* 4. The method AddDataElementToSchemaIfNotPresent() is modifying the document. To show your intent (make it obvious the document | |
* is going to be potentially modified) should do one of the following | |
* a. Either make the argument a "ref" argument | |
* b. Return the modified document from this method. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal static class Program | |
{ | |
static void Main(string[] args) | |
{ | |
/* | |
* We have an XM Document and now we're attempting to validate the schema of | |
* this document against an Xml Schema document. The next line of code is | |
* simply attempting to retrieve the Xml Schema document. | |
* The applicationRootFolder argument is determined at runtime (dependant upon the runtime context; Console app or Web App etc.) | |
* The fileName argument comes from the config file. The concatenation of the 2 is the full path and file name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ASP.NET Core (.NET Framework) | |
# Build and test ASP.NET Core projects targeting the full .NET Framework. | |
# Add steps that publish symbols, save build artifacts, and more: | |
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core | |
trigger: | |
- master | |
pool: | |
vmImage: 'windows-latest' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal static class Randomizer | |
{ | |
private static int[] s_punctuationACIICodes = { 33, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 58, 59, 60, 61, 62, 63, 64, 91, 92, 93, 94, 95, 123, 124, 125, 126 }; | |
private static RNGCryptoServiceProvider rngCrypto = new RNGCryptoServiceProvider(); | |
private static int GetRandomNumber() | |
{ | |
var buffer = new byte[4]; | |
rngCrypto.GetBytes(buffer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class OneToManyMapDictionaryTests | |
{ | |
private static IOneToManyMap<TKey, TValue> InitializeOneToManyMap<TKey, TValue>(TKey key, TValue[] values) | |
{ | |
var oneToManyMap = new OneToManyMapDictionary<TKey, TValue>(); | |
oneToManyMap.AddOneToManyMapping(key, values); | |
return oneToManyMap; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class OneToManyMapDictionaryTests | |
{ | |
private static IOneToManyMap<TKey, TValue> InitializeOneToManyMap<TKey, TValue>(TKey key, TValue[] values) | |
{ | |
var oneToManyMap = new OneToManyMapDictionary<TKey, TValue>(); | |
oneToManyMap.AddOneToManyMapping(key, values); | |
return oneToManyMap; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UserSettings><ApplicationIdentity version="16.0"/><ToolsOptions><ToolsOptionsCategory name="Environment" RegisteredName="Environment"><ToolsOptionsSubCategory name="General" RegisteredName="General" PackageName="Visual Studio Environment Package"> | |
<PropertyValue name="AnimationSpeed">7</PropertyValue> | |
<PropertyValue name="AutoAdjustExperience">true</PropertyValue> | |
<PropertyValue name="AutohidePinActiveTabOnly">false</PropertyValue> | |
<PropertyValue name="CloseButtonActiveTabOnly">true</PropertyValue> | |
<PropertyValue name="MRUListContainsNItems">10</PropertyValue> | |
<PropertyValue name="ShowStatusBar">true</PropertyValue> | |
<PropertyValue name="WindowMenuContainsNItems">10</PropertyValue> | |
</ToolsOptionsSubCategory><ToolsOptionsSubCategory name="ProjectsAndSolution" RegisteredName="ProjectsAndSolution" PackageName="Visual Studio Environment Package"><PropertyValue name="ProjectsLocation">%vsspv_user_appdata%\Source\Repos</PropertyValue><PropertyValue name="PromptForRenameSymbol">true</P |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Create a new Empty ASP.NET Core project | |
* Replace the entire Startup class (not the namespace) with the code below | |
*/ | |
public class Startup | |
{ | |
// This method gets called by the runtime. Use this method to add services to the container. | |
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 | |
public void ConfigureServices(IServiceCollection services) |
NewerOlder