Skip to content

Instantly share code, notes, and snippets.

View EngRajabi's full-sized avatar

Mohsen Rajabi EngRajabi

View GitHub Profile
using System;
[assembly: CLSCompliant(false)]
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="MyArtifactory" value="https://my.organazation.dev/artifactory/api/nuget/v3/nuget" protocolVersion="3" />
</packageSources>
</configuration>
{
"sdk": {
"version": "7.0.405",
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
# Created by https://www.toptal.com/developers/gitignore/api/rider,csharp,aspnetcore,dotnetcore,visualstudiocode,visualstudio
# Edit at https://www.toptal.com/developers/gitignore?templates=rider,csharp,aspnetcore,dotnetcore,visualstudiocode,visualstudio
### ASPNETCore ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
# https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md
P:System.DateTime.Now;Use System.DateTime.UtcNow instead
P:System.DateTimeOffset.Now;Use System.DateTimeOffset.UtcNow instead
P:System.DateTimeOffset.DateTime;Use System.DateTimeOffset.UtcDateTime instead
#T:Newtonsoft.Json;Don't use Newtonsoft, use System.Text.Json
#N:Newtonsoft.Json;Don't use Newtonsoft
#T:Newtonsoft.Json.JsonPropertyAttribute;Don't use Newtonsoft
#N:Newtonsoft.Json.JsonPropertyAttribute;Don't use Newtonsoft
#T:Newtonsoft.Json.JsonConvert;Don't use Newtonsoft
#N:Newtonsoft.Json.JsonConvert;Don't use Newtonsoft
<Project>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="FluentAssertions.Analyzers" Version="0.29.1" />
<PackageVersion Include="xunit.analyzers" Version="1.10.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.Swagger" Version="6.5.0" />
; Top-most http://editorconfig.org/ file
root = true
[*]
insert_final_newline = true
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
[*.cs]
<Project>
<PropertyGroup>
<LangVersion>11.0</LangVersion>
<AnalysisLevel>latest</AnalysisLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
public static partial class TestRegexSourceGenerator
{
// The Source Generator generates the code of the method at compile time
[RegexGenerator(@"\d+", RegexOptions.Compiled, 50)]
private static partial Regex IsDigitRegex();
public static bool IsDigit(string value)
{
return IsDigitRegex().IsMatch(value);
}
public static class UserTypeTestEnumExtensions
{
public static string StringToFast(this UnitTests.UserTypeTest states)
{
return states switch
{
UnitTests.UserTypeTest.Men => nameof(UnitTests.UserTypeTest.Men),
UnitTests.UserTypeTest.Women => nameof(UnitTests.UserTypeTest.Women),
UnitTests.UserTypeTest.None => nameof(UnitTests.UserTypeTest.None),
_ => throw new ArgumentOutOfRangeException(nameof(states), states, null)