Skip to content

Commit

Permalink
Adding some functionality to ObjectId to make
Browse files Browse the repository at this point in the history
it jibe with a MongoDB object ID
  • Loading branch information
dgmjr committed Oct 22, 2023
1 parent 9d76eb5 commit b21d5be
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 112 deletions.
12 changes: 7 additions & 5 deletions Tests/Dgmjr.Primitives.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="coverlet.collector" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Dgmjr.System.Extensions" />
<PackageReference Include="Dgmjr.Primitives" />
<PackageReference Include="Dgmjr.System.Extensions" />
<PackageReference Include="Dgmjr.Testing.Logging" />
<PackageReference Include="Dgmjr.Testing.Tests" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="xunit" />
<PackageReference Include="Vogen" />
<ProjectReference Include="../src/Dgmjr.Primitives.csproj" />
<UsingsPackageReference Include="System.Text.RegularExpressions.Usings" />
</ItemGroup>


Expand Down
89 changes: 30 additions & 59 deletions Tests/Dgmjr.Primitives.Tests.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,15 @@
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
ProjectSection(SolutionItems) = preProject
..\..\..\..\Packages\Versions.props = ..\..\..\..\Packages\Versions.props
..\..\..\..\Packages\Versions.Local.json = ..\..\..\..\Packages\Versions.Local.json
..\..\..\..\Directory.Build.props = ..\..\..\..\Directory.Build.props
..\..\..\..\Directory.Build.targets = ..\..\..\..\Directory.Build.targets
..\..\..\..\global.json = ..\..\..\..\global.json
..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\Packages\Versions.Local.props
..\..\..\..\Packages\Packages.pkgs = ..\..\..\..\Packages\Packages.pkgs
..\..\..\..\Packages\Packages\AnyOf.pkgs = ..\..\..\..\Packages\Packages\AnyOf.pkgs
..\..\..\..\Packages\Packages\APIVersioning.pkgs = ..\..\..\..\Packages\Packages\APIVersioning.pkgs
..\..\..\..\Packages\Packages\AutoMapper.pkgs = ..\..\..\..\Packages\Packages\AutoMapper.pkgs
..\..\..\..\Packages\Packages\Azure.pkgs = ..\..\..\..\Packages\Packages\Azure.pkgs
..\..\..\..\Packages\Packages\AzureFunctions.pkgs = ..\..\..\..\Packages\Packages\AzureFunctions.pkgs
..\..\..\..\Packages\Packages\DDD.pkgs = ..\..\..\..\Packages\Packages\DDD.pkgs
..\..\..\..\Packages\Packages\EFCore.pkgs = ..\..\..\..\Packages\Packages\EFCore.pkgs
..\..\..\..\Packages\Packages\GlobalBuild.pkgs = ..\..\..\..\Packages\Packages\GlobalBuild.pkgs
..\..\..\..\Packages\Packages\GlobalCodeGenerators.pkgs = ..\..\..\..\Packages\Packages\GlobalCodeGenerators.pkgs
..\..\..\..\Packages\Packages\Images.pkgs = ..\..\..\..\Packages\Packages\Images.pkgs
..\..\..\..\Packages\Packages\McMaster.CommandLineUtils.pkgs = ..\..\..\..\Packages\Packages\McMaster.CommandLineUtils.pkgs
..\..\..\..\Packages\Packages\MediatR.pkgs = ..\..\..\..\Packages\Packages\MediatR.pkgs
..\..\..\..\Packages\Packages\Microsoft.AspNetCore.pkgs = ..\..\..\..\Packages\Packages\Microsoft.AspNetCore.pkgs
..\..\..\..\Packages\Packages\Microsoft.Extensions.pkgs = ..\..\..\..\Packages\Packages\Microsoft.Extensions.pkgs
..\..\..\..\Packages\Packages\Microsoft.Identity.pkgs = ..\..\..\..\Packages\Packages\Microsoft.Identity.pkgs
..\..\..\..\Packages\Packages\Microsoft.VisualStudio.Shell.Interop.pkgs = ..\..\..\..\Packages\Packages\Microsoft.VisualStudio.Shell.Interop.pkgs
..\..\..\..\Packages\Packages\Miscellany.pkgs = ..\..\..\..\Packages\Packages\Miscellany.pkgs
..\..\..\..\Packages\Packages\MSBuild.pkgs = ..\..\..\..\Packages\Packages\MSBuild.pkgs
..\..\..\..\Packages\Packages\MSBuildProjectCreator.pkgs = ..\..\..\..\Packages\Packages\MSBuildProjectCreator.pkgs
..\..\..\..\Packages\Packages\MSBuildSdks.pkgs = ..\..\..\..\Packages\Packages\MSBuildSdks.pkgs
..\..\..\..\Packages\Packages\Newtonsoft.Json.pkgs = ..\..\..\..\Packages\Packages\Newtonsoft.Json.pkgs
..\..\..\..\Packages\Packages\NuGet.pkgs = ..\..\..\..\Packages\Packages\NuGet.pkgs
..\..\..\..\Packages\Packages\Powershell.pkgs = ..\..\..\..\Packages\Packages\Powershell.pkgs
..\..\..\..\Packages\Packages\Roslyn.pkgs = ..\..\..\..\Packages\Packages\Roslyn.pkgs
..\..\..\..\Packages\Packages\Serilog.pkgs = ..\..\..\..\Packages\Packages\Serilog.pkgs
..\..\..\..\Packages\Packages\SlnGen.pkgs = ..\..\..\..\Packages\Packages\SlnGen.pkgs
..\..\..\..\Packages\Packages\Swashbuckle.pkgs = ..\..\..\..\Packages\Packages\Swashbuckle.pkgs
..\..\..\..\Packages\Packages\System.pkgs = ..\..\..\..\Packages\Packages\System.pkgs
..\..\..\..\Packages\Packages\Telegram.pkgs = ..\..\..\..\Packages\Packages\Telegram.pkgs
..\..\..\..\Packages\Packages\Testing.EfCore.pkgs = ..\..\..\..\Packages\Packages\Testing.EfCore.pkgs
..\..\..\..\Packages\Packages\Testing.pkgs = ..\..\..\..\Packages\Packages\Testing.pkgs
..\..\..\..\Packages\Packages\Validation.pkgs = ..\..\..\..\Packages\Packages\Validation.pkgs
..\..\..\..\Packages\Packages\XmlDocMd.pkgs = ..\..\..\..\Packages\Packages\XmlDocMd.pkgs
..\..\..\..\Packages\Versions\AspNetCoreIdentity.props = ..\..\..\..\Packages\Versions\AspNetCoreIdentity.props
..\..\..\..\Packages\Versions\AutoMapper.props = ..\..\..\..\Packages\Versions\AutoMapper.props
..\..\..\..\Packages\Versions\CoreIntegratedLibs.props = ..\..\..\..\Packages\Versions\CoreIntegratedLibs.props
..\..\..\..\Packages\Versions\EFCore.props = ..\..\..\..\Packages\Versions\EFCore.props
..\..\..\..\Packages\Versions\JsonPatch.props = ..\..\..\..\Packages\Versions\JsonPatch.props
..\..\..\..\Packages\Versions\MediatR.props = ..\..\..\..\Packages\Versions\MediatR.props
..\..\..\..\Packages\Versions\Microsoft.CodeAnalysis.props = ..\..\..\..\Packages\Versions\Microsoft.CodeAnalysis.props
..\..\..\..\Packages\Versions\Microsoft.Extensions.Logging.props = ..\..\..\..\Packages\Versions\Microsoft.Extensions.Logging.props
..\..\..\..\Packages\Versions\MSBuild.props = ..\..\..\..\Packages\Versions\MSBuild.props
..\..\..\..\Packages\Versions\PowerShell.props = ..\..\..\..\Packages\Versions\PowerShell.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Primitives.Tests", "Dgmjr.Primitives.Tests.csproj", "{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Primitives", "..\src\Dgmjr.Primitives.csproj", "{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Primitives.Tests", "Dgmjr.Primitives.Tests.csproj", "{028D927A-D932-4DC0-B8CC-0FADA0950F0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -63,18 +22,30 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Local|Any CPU.ActiveCfg = Local|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Local|Any CPU.Build.0 = Local|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Testing|Any CPU.Build.0 = Testing|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Staging|Any CPU.Build.0 = Staging|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Production|Any CPU.ActiveCfg = Local|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Production|Any CPU.Build.0 = Local|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89D6F98C-27F8-46DE-9F4A-4381BBEAD6B5}.Release|Any CPU.Build.0 = Release|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Local|Any CPU.ActiveCfg = Local|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Local|Any CPU.Build.0 = Local|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Testing|Any CPU.Build.0 = Testing|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Staging|Any CPU.Build.0 = Staging|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Production|Any CPU.ActiveCfg = Local|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Production|Any CPU.Build.0 = Local|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E1F4A52-7F97-43E1-AAA6-2EEEE07326E6}.Release|Any CPU.Build.0 = Release|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Local|Any CPU.ActiveCfg = Local|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Local|Any CPU.Build.0 = Local|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Testing|Any CPU.Build.0 = Testing|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Staging|Any CPU.Build.0 = Staging|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Production|Any CPU.ActiveCfg = Local|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Production|Any CPU.Build.0 = Local|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{028D927A-D932-4DC0-B8CC-0FADA0950F0A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
96 changes: 63 additions & 33 deletions Tests/Dgmjr.Primitives.Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tests/DurationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Dgmjr.Primitives.Tests;

public class DurationTests : BaseTest
{
public DurationTests(IOutputHelper output)
public DurationTests(ITestOutputHelper output)
: base(output) { }

[Theory]
Expand Down
8 changes: 6 additions & 2 deletions Tests/iriTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Text.RegularExpressions;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;

Expand Down Expand Up @@ -52,8 +53,11 @@ public iriTests(ITestOutputHelper output)
)?
)?$";

[GeneratedRegex(RegexString, Compiled | Singleline | IgnoreCase | IgnorePatternWhitespace)]
private static partial Regex Regex();
[GeneratedRegex(
RegexString,
Rxo.Compiled | Rxo.Singleline | Rxo.IgnoreCase | Rxo.IgnorePatternWhitespace
)]
public static partial Regex Regex();

protected override string[][] InvalidValuesStrings => new[] { new[] { "fcku!!!!!!" } };

Expand Down
4 changes: 2 additions & 2 deletions src/Int24.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ namespace System
private readonly byte _b2;

public static implicit operator uint(i24 value) =>
(uint)value | (uint)(value >> BitOffset) | (uint)(value >> BitOffset * 2);
(uint)value._b0 | (uint)(value._b1 >> BitOffset) | (uint)(value._b2 >> BitOffset * 2);

public static implicit operator int(i24 value) =>
(int)value | (int)(value >> BitOffset) | (int)(value >> BitOffset * 2);
(int)value._b0 | (int)(value._b1 >> BitOffset) | (int)(value._b2 >> BitOffset * 2);

/// <summary>
/// Gets the value of the integer.
Expand Down
Loading

0 comments on commit b21d5be

Please sign in to comment.