microsoft/healthcare-shared-components
Publicmirrored from https://github.com/microsoft/healthcare-shared-componentsAvailable
src/Microsoft.Health.Core/Internal/ClockResolver.cs
22lines · modecode
| 1 | // ------------------------------------------------------------------------------------------------- |
| 2 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. |
| 4 | // ------------------------------------------------------------------------------------------------- |
| 5 | |
| 6 | using System; |
| 7 | |
| 8 | namespace Microsoft.Health.Core.Internal |
| 9 | { |
| 10 | /// <summary> |
| 11 | /// Not the clock you're looking for. |
| 12 | /// Used to override the static Clock class's UtcNowFunc for use in testing. |
| 13 | /// </summary> |
| 14 | public static class ClockResolver |
| 15 | { |
| 16 | public static Func<DateTimeOffset> UtcNowFunc |
| 17 | { |
| 18 | get => Clock.UtcNowFunc; |
| 19 | set => Clock.UtcNowFunc = value; |
| 20 | } |
| 21 | } |
| 22 | } |