Summary of The RIGHT way to deal with Date and Time in C#

This is an AI generated summary. There may be inaccuracies.
Summarize another video · Purchase summarize.tech Premium

00:00:00 - 00:05:00

In this video, Nick demonstrates how to properly deal with date and time in C# code to make sure that it is testable. He explains how to create a simple class and unit test it, demonstrating that the code is returning what it should. He then shows how to inject a date time provider into the code of a Griddle service and remove the dependency on the system clock, allowing tests to pass even when running on different dates and times. This makes it easier to test the code and avoid potential errors.

  • 00:00:00 In this video, Nick demonstrates how to properly deal with date and time in C# code to make sure that it is testable. He explains how to create a simple class and unit test it, demonstrating that the code is returning what it should. He then shows how to inject a date time provider into the code of a Griddle service and remove the dependency on the system clock, allowing tests to pass even when running on different dates and times.
  • 00:05:00 The presenter discusses how to deal with date and time in C#, explaining how to use private read-only gridservice and pass it down to a constructor, how to use a mock for the date and time provider, and how to use an interface to make life easier. They also discuss how common the problem is and how developers have not standardized the way they deal with date and time.

Copyright © 2025 Summarize, LLC. All rights reserved. · Terms of Service · Privacy Policy · As an Amazon Associate, summarize.tech earns from qualifying purchases.