microsoft/healthcare-shared-components
Publicmirrored from https://github.com/microsoft/healthcare-shared-componentsAvailable
src/Microsoft.Health.Core.UnitTests/Extensions/DateTimeExtensionsTests.cs
20lines · modecode
| 1 | // ------------------------------------------------------------------------------------------------- |
| 2 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. |
| 4 | // ------------------------------------------------------------------------------------------------- |
| 5 | |
| 6 | using System; |
| 7 | using Xunit; |
| 8 | |
| 9 | namespace Microsoft.Health.Core.Extensions.UnitTests |
| 10 | { |
| 11 | public class DateTimeExtensionsTests |
| 12 | { |
| 13 | [Fact] |
| 14 | public void GivenADateTime_WhenTruncated_HasNoFractionalMilliseconds() |
| 15 | { |
| 16 | var dateTime = new DateTime(2019, 1, 1); |
| 17 | Assert.Equal(dateTime, dateTime.AddTicks(1).TruncateToMillisecond()); |
| 18 | } |
| 19 | } |
| 20 | } |