feat(*): Add SystemTime.Now method

This commit is contained in:
Josh Creek
2021-09-02 20:00:46 +01:00
parent 03ce3a50ec
commit 14530efb0f
2 changed files with 20 additions and 2 deletions
@@ -19,8 +19,8 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryType>git</RepositoryType>
<PackageTags>creek</PackageTags>
<Version>1.1.0</Version>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<Version>1.2.0</Version>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Creek.HelpfulExtensions
{
public static class SystemTime
{
/// <summary>
/// This method exposes DateTime.Now as an instance of a function, that can be replaced in tests.
/// </summary>
#pragma warning disable S1104 // Fields should not have public accessibility
#pragma warning disable S2223 // Non-constant static fields should not be visible
public static Func<DateTime> Now = () => DateTime.Now;
#pragma warning restore S2223 // Non-constant static fields should not be visible
#pragma warning restore S1104 // Fields should not have public accessibility
}
}