Bending DateTime in .NET to Test Your Code Better

2022-01-23

Learn how to solve the problem of validating actual time in your code when using DateTime.Now or DateTime.UtcNow. Author Stephen Walsh shares his solution using SimpleDateTimeProvider NuGet Package which consists of an interface and two implementations of the interface, one returning System values and the other returning Mocked values. The article includes code samples for each implementation and tips for using the provider in your functional code. Make testing your code even better with this simple solution. #dotnet #testing #validation #nuget

Link [ https://dev.to/stphnwlsh/bending-datetime-in-net-to-test-your-code-better-2lon ]

Previous Article

Bending DateTime in .NET to Test Your Code Better

2022-01-23

Learn how to solve the problem of validating actual time in your code when using DateTime.Now or DateTime.UtcNow. Author Stephen Walsh shares his solution using SimpleDateTimeProvider NuGet Package which consists of an interface and two implementations of the interface, one returning System values and the other returning Mocked values. The article includes code samples for each implementation and tips for using the provider in your functional code. Make testing your code even better with this simple solution. #dotnet #testing #validation #nuget

Link [ https://dev.to/stphnwlsh/bending-datetime-in-net-to-test-your-code-better-2lon ]

Copyright © 2024 All rights reserved

Rss

Atom