示例#1
0
        public void UnixCreateFromeTimeSpan()
        {
            // Arrange
            var factory = new UnixTimestampFactory();

            // Act
            var zero = factory.Create(TimeSpan.Zero);

            // Assert
            Assert.Equal(0, zero);
        }
示例#2
0
        public void CreateUnix(DateTimeKind kind)
        {
            // Arrange
            var factory = new UnixTimestampFactory();
            var z       = DateTime.UnixEpoch.ToUniversalTime();

            // Act
            if (kind != DateTimeKind.Utc)
            {
                z = z.ToLocalTime();
            }
            if (kind == DateTimeKind.Unspecified)
            {
                z = DateTime.SpecifyKind(z, DateTimeKind.Unspecified);
            }
            var zero = factory.Create(z);

            // Assert
            Assert.Equal(0, zero);
        }