Dotnet, Development, C Sharp Programming, Csharp, Microsoft.
c.UtcNow).Returns(expecteDate); New Approach: Time Abstraction .NET 8 make this easier for us with the Time Abstraction feature. Now you don’t need to create this wrapper class anymore, instead, you can make use of the TimeProvider, and use it via dependency injection, and use it to get the time: