Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Story
How we grew from 0 to 3 million users
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

The BEST .NET 8 Feature For Testing

1.9K views
•
August 22, 2023
by
Gui Ferreira
YouTube video player
The BEST .NET 8 Feature For Testing

TL;DR

Learn how to solve the problem of non-deterministic tests related to date and time in .NET 8 using the new Time Abstraction feature.

Transcript

most non-deterministic.net tests that I have seen during my career Were Somehow related to date time and I bet that you have seen exactly the same and that's why in this video I will show you an amazing feature that is coming.net8 that will finally and let me say this again finally will address this issue I have here an example to show you the prob... Read More

Key Insights

  • 👫 Non-deterministic tests related to date and time have been a common issue in .NET development.
  • 🏛️ The traditional approach to solving this problem is to create an interface and implementing class to encapsulate date and time logic.
  • 🏛️ The new Time Abstraction feature in .NET 8 provides a built-in TimeProvider class that simplifies the process of mocking date and time for testing.
  • 👫 Adopting Time Abstraction as a standard practice can reduce code duplication and maintenance for tests that involve date and time logic.
  • ⚾ Time Abstraction is a step towards making time-based tests more straightforward and deterministic in .NET.
  • 📚 The TimeProvider class in .NET 8 can be easily mocked using libraries like Moq or TimeProvider.Testing.
  • 😠 The introduction of Time Abstraction by Microsoft shows a recognition of the challenges developers face with non-deterministic tests related to date and time.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: What is the problem with non-deterministic tests related to date and time in .NET?

Non-deterministic tests can fail when run on different dates due to reliance on the current date and time. This makes testing and maintaining the code difficult.

Q: How can the problem of non-deterministic tests be solved in .NET?

One solution is to create an interface, IDateTimeProvider, and an implementing class that encapsulates the date and time logic. Mocking frameworks like Moq can then be used to provide different dates for testing.

Q: What is the new feature in .NET 8 that addresses non-deterministic tests?

The new feature is called Time Abstraction, which provides a built-in TimeProvider class. This class can be easily mocked for testing, eliminating the manual creation of interfaces and implementations.

Q: What are the benefits of using Time Abstraction in .NET 8?

Using Time Abstraction reduces code duplication and maintenance by providing a standardized way to handle date and time logic in tests. It also promotes best practices and simplifies testing.

Key Insights:

  • Non-deterministic tests related to date and time have been a common issue in .NET development.
  • The traditional approach to solving this problem is to create an interface and implementing class to encapsulate date and time logic.
  • The new Time Abstraction feature in .NET 8 provides a built-in TimeProvider class that simplifies the process of mocking date and time for testing.
  • Adopting Time Abstraction as a standard practice can reduce code duplication and maintenance for tests that involve date and time logic.
  • Time Abstraction is a step towards making time-based tests more straightforward and deterministic in .NET.
  • The TimeProvider class in .NET 8 can be easily mocked using libraries like Moq or TimeProvider.Testing.
  • The introduction of Time Abstraction by Microsoft shows a recognition of the challenges developers face with non-deterministic tests related to date and time.
  • Encapsulating date and time logic behind an interface or using Time Abstraction can improve the reliability and determinism of tests.

Summary & Key Takeaways

  • Non-deterministic tests related to date and time have been a common issue in .NET. Tests that rely on the current date can fail when run on different days.

  • The traditional solution to this problem is to create an interface, IDateTimeProvider, and an implementing class to encapsulate the date and time logic. Mocking frameworks like Moq can be used to provide different dates for testing.

  • The new Time Abstraction feature in .NET 8 provides a built-in TimeProvider class that can be easily mocked for testing, eliminating the need for manual interfaces and implementations.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from Gui Ferreira 📚

9 JetBrains Rider Secrets You Should Know - Plus a Special Giveaway! thumbnail
9 JetBrains Rider Secrets You Should Know - Plus a Special Giveaway!
Gui Ferreira
Coupling and Cohesion Explained thumbnail
Coupling and Cohesion Explained
Gui Ferreira
Building better DTOs in C# thumbnail
Building better DTOs in C#
Gui Ferreira

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots
  • Open Graph Checker

Company

  • About us
  • Our Story
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.