Dotnet, Development, C Sharp Programming, Csharp, Microsoft.
12 and <= 18 => "Afternoon", > 18 and <= 24 => "Evening", _ => "Night" }; return message; } } And you can also easily Mock it in your tests: _timeProviderMock.Setup(c => c.GetUtcNow()).Returns(expectedDate); For example, in the code below you can see a unit test class that tests the GetTimeOfDay