dotnet / dotnet/docs

`FakeTimeProvider` allows you to mock time in test scenarios

Open
#42,764 0 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
19h 10m
Merged PRs (30d)
268

Description

### Type of issue

Typo

### Description

From https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8/runtime#time-abstraction

> The new [TimeProvider](https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider) class and [ITimer](https://learn.microsoft.com/en-us/dotnet/api/system.threading.itimer) interface add time abstraction functionality, which allows you to mock time in test scenarios.

But it is not `TimeProvider` which allows mocking. That is [`FakeTimeProvider`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.time.testing.faketimeprovider?view=net-8.0).

I would say, some note on its existance worth it.

### Page URL

https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8/runtime

### Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/whats-new/dotnet-8/runtime.md

### Document Version Independent Id

15cdd77f-e040-364f-035a-cecb0fac7cb6

### Article author

@gewarren

### Metadata

* ID: cf0836eb-9b39-9da3-0bf8-cf9cd982727d
* Service: **dotnet-fundamentals**

[Related Issues](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+15cdd77f-e040-364f-035a-cecb0fac7cb6)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.