예제 #1
0
        public void LongCreateFromeTimeSpan()
        {
            // Arrange
            var factory = new LongTimestampFactory();

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

            // Assert
            Assert.Equal(0, zero);
        }
예제 #2
0
        public void TimeLong()
        {
            // Arrange
            var factory = new LongTimestampFactory();

            // Act
            var zero = factory.ToTimeSpan(0);

            // Assert
            Assert.Equal(TimeSpan.Zero, zero);
        }
예제 #3
0
        public void CreateLong(DateTimeKind kind)
        {
            // Arrange
            var factory = new LongTimestampFactory();
            var z       = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);

            // 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);
        }
예제 #4
0
        public void ZeroLong(DateTimeKind kind)
        {
            // Arrange
            var factory = new LongTimestampFactory();
            var z       = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);

            // Act
            var zero = factory.GetZero(kind);

            if (z.Kind != kind)
            {
                z = z.ToLocalTime();
            }
            if (kind == DateTimeKind.Unspecified)
            {
                z = DateTime.SpecifyKind(z, DateTimeKind.Unspecified);
            }

            // Assert
            Assert.Equal(kind, zero.Kind);
            Assert.Equal(z, zero);
        }