Dotnet, Development, C Sharp Programming, Csharp, Microsoft.
currentTime.Hour switch { >= 6 and <= 12 => "Morning", > 12 and <= 18 => "Afternoon", > 18 and <= 24 => "Evening", _ => "Night" }; return message; } } Now in your tests, it is possible to mock the UtcNow result, to return the date you need, for example: _dateTimeOffsetProviderMock.Setup(c =>