From eead7379dede14b3b0373403bcbe9cde62b34930 Mon Sep 17 00:00:00 2001 From: Egil Hansen Date: Mon, 25 Sep 2023 13:59:35 +0000 Subject: [PATCH] fix: csproj must include a readme --- ...meProviderExtensions.ManualTimeProvider.md | 30 +++++++++--------- .../TimeProviderExtensions.csproj | 31 ++++++------------- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/docs/TimeProviderExtensions.ManualTimeProvider.md b/docs/TimeProviderExtensions.ManualTimeProvider.md index c7010b1..9f66d85 100644 --- a/docs/TimeProviderExtensions.ManualTimeProvider.md +++ b/docs/TimeProviderExtensions.ManualTimeProvider.md @@ -30,51 +30,51 @@ This creates a provider whose time is initially set to midnight January 1st 2000 with the local time zone set to [System.TimeZoneInfo.Utc](https://docs.microsoft.com/en-us/dotnet/api/System.TimeZoneInfo.Utc 'System.TimeZoneInfo.Utc'). The provider is set to not automatically advance time each time it is read. - + -## ManualTimeProvider(DateTimeOffset) Constructor +## ManualTimeProvider(DateTimeOffset, TimeZoneInfo) Constructor Initializes a new instance of the [ManualTimeProvider](TimeProviderExtensions.ManualTimeProvider.md 'TimeProviderExtensions.ManualTimeProvider') class. ```csharp -public ManualTimeProvider(System.DateTimeOffset startDateTime); +public ManualTimeProvider(System.DateTimeOffset startDateTime, System.TimeZoneInfo localTimeZone); ``` #### Parameters - + `startDateTime` [System.DateTimeOffset](https://docs.microsoft.com/en-us/dotnet/api/System.DateTimeOffset 'System.DateTimeOffset') The initial time and date reported by the provider. + + +`localTimeZone` [System.TimeZoneInfo](https://docs.microsoft.com/en-us/dotnet/api/System.TimeZoneInfo 'System.TimeZoneInfo') + +Optional local time zone to use during testing. Defaults to [System.TimeZoneInfo.Utc](https://docs.microsoft.com/en-us/dotnet/api/System.TimeZoneInfo.Utc 'System.TimeZoneInfo.Utc'). + ### Remarks -The local time zone set to [System.TimeZoneInfo.Utc](https://docs.microsoft.com/en-us/dotnet/api/System.TimeZoneInfo.Utc 'System.TimeZoneInfo.Utc'). The provider is set to not automatically advance time each time it is read. - + -## ManualTimeProvider(DateTimeOffset, TimeZoneInfo) Constructor +## ManualTimeProvider(DateTimeOffset) Constructor Initializes a new instance of the [ManualTimeProvider](TimeProviderExtensions.ManualTimeProvider.md 'TimeProviderExtensions.ManualTimeProvider') class. ```csharp -public ManualTimeProvider(System.DateTimeOffset startDateTime, System.TimeZoneInfo localTimeZone); +public ManualTimeProvider(System.DateTimeOffset startDateTime); ``` #### Parameters - + `startDateTime` [System.DateTimeOffset](https://docs.microsoft.com/en-us/dotnet/api/System.DateTimeOffset 'System.DateTimeOffset') The initial time and date reported by the provider. - - -`localTimeZone` [System.TimeZoneInfo](https://docs.microsoft.com/en-us/dotnet/api/System.TimeZoneInfo 'System.TimeZoneInfo') - -Optional local time zone to use during testing. Defaults to [System.TimeZoneInfo.Utc](https://docs.microsoft.com/en-us/dotnet/api/System.TimeZoneInfo.Utc 'System.TimeZoneInfo.Utc'). - ### Remarks +The local time zone set to [System.TimeZoneInfo.Utc](https://docs.microsoft.com/en-us/dotnet/api/System.TimeZoneInfo.Utc 'System.TimeZoneInfo.Utc'). The provider is set to not automatically advance time each time it is read. ### Properties diff --git a/src/TimeProviderExtensions/TimeProviderExtensions.csproj b/src/TimeProviderExtensions/TimeProviderExtensions.csproj index edd7b75..fe13d89 100644 --- a/src/TimeProviderExtensions/TimeProviderExtensions.csproj +++ b/src/TimeProviderExtensions/TimeProviderExtensions.csproj @@ -6,29 +6,12 @@ Egil Hansen Egil Hansen -# TimeProvider Extensions - -Testing extensions for the [`System.TimeProvider`](https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider) API. It includes: - -- An advanced test/fake version of the `TimeProvider` type, named `ManualTimeProvider`, that allows you to control the progress of time during testing deterministically (see the difference to Microsoft's `FakeTimeProvider` below). -- A backported version of `PeriodicTimer` that supports `TimeProvider` in .NET 6. - -## Quick start - -This describes how to get started: - -1. Get the latest release from https://www.nuget.org/packages/TimeProviderExtensions. - -2. Take a dependency on `TimeProvider` in your production code. Inject the production version of `TimeProvider` available via the [`TimeProvider.System`](https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider.system?#system-timeprovider-system) property during production. - -3. During testing, inject the `ManualTimeProvider` from this library. This allows you to write tests that run fast and predictably. - - Advance time by calling `Advance(TimeSpan)` or `SetUtcNow(DateTimeOffset)` or - - Jump ahead in time using `Jump(TimeSpan)` or `Jump(DateTimeOffset)`. - -4. See the **[`ManualTimeProvider API`](https://github.com/egil/TimeProviderExtensions/blob/main/docs/TimeProviderExtensions.ManualTimeProvider.md) page** for the full API documentation for `ManualTimeProvider`. - -5. Read the [README](https://github.com/egil/TimeProviderExtensions) for further details and examples. + Testing extensions for the [`System.TimeProvider`](https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider) API. It includes + an advanced test/fake version of the `TimeProvider` type, named `ManualTimeProvider`, that allows you to control the progress of time + during testing deterministically (see the difference to Microsoft's `FakeTimeProvider` below) and a backported version of + `PeriodicTimer` that supports `TimeProvider` in .NET 6. + README.md TimeProvider, testing Egil Hansen https://github.com/egil/TimeProviderExtensions @@ -91,6 +74,10 @@ This describes how to get started: True \ + + True + \ +