question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manage Time-Related code via `TimeProvider` (.NET8)

See original GitHub issue

In order to improve the testability of the system FastEndpoints should not depend on DateTime.UtcNow.

It’s highly advisable to introduce a System Time Provider.

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dj-nitehawkcommented, Jun 27, 2023

@MrBogomips implemented in v5.13.0.1-beta. see changelog here: https://github.com/FastEndpoints/FastEndpoints/blob/main/Src/Library/changelog.md#-new

and i believe the FastEndpoints.Security package is the only place we need to use the TimeProvider in, since all other places don’t seem to effect what the end user can interact with.

if you find something else that requires the use of TimeProvider, do let me know and it will be easy to add support for that.

0reactions
dj-nitehawkcommented, Jun 15, 2023

will look in to that when i get a chance…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing Unit Tests with Time in .NET 8 Preview 4 - InfoQ
NET 8 Preview 4 introduces TimeProvider and ITimer, universal time abstractions for dependency injection and unit testing.
Read more >
.NET 8 TimeProvider and Unit Tests | ...
Let's look at a complete timer test. The previous code creates a timer, but we only execute the callback when the time is...
Read more >
TimeProvider Class (System)
Gets a TimeProvider that provides a clock based on UtcNow, a time zone based on Local, a high-performance time stamp based on Stopwatch,...
Read more >
A New Way To Deal With Time In .NET 8 - YouTube
Join me on Patreon to get the source code : https://www.patreon.com/juliocasal My Free . NET Backend Developer Roadmap: ...
Read more >
The Problem with Time That .NET 8 Finally Fixed - YouTube
NET 8 type, called TimeProvider, which aims to solve a problem that has been in ... Keep coding merch: https://keepcoding.shop #csharp #dotnet.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found