Example #1
0
        public void ToIso8601FormattedDateTime()
        {
            var dateTime = DateTimeConvertor.FromIso8601FormattedDateTime("2011-08-04T07:00:00+0000");

            var result = DateTimeConvertor.ToIso8601FormattedDateTime(dateTime);

            Assert.Equal(result, "2011-08-04T07:00:00Z");
        }
Example #2
0
        public void FromIso8601FormattedDateTime()
        {
            var result = DateTimeConvertor.FromIso8601FormattedDateTime("2011-08-04T07:00:00+0000");

            Assert.Equal(result.Year, 2011);
            Assert.Equal(result.Month, 8);
            Assert.Equal(result.Day, 4);

            Assert.Equal(result.Hour, 7);
            Assert.Equal(result.Minute, 0);
            Assert.Equal(result.Second, 0);
        }
            public void FromZ()
            {
                var result = DateTimeConvertor.FromIso8601FormattedDateTime("2012-01-28T18:14:33Z");

                Assert.Equal(2012, result.Year);
                Assert.Equal(1, result.Month);
                Assert.Equal(28, result.Day);

                Assert.Equal(18, result.Hour);
                Assert.Equal(14, result.Minute);
                Assert.Equal(33, result.Second);
            }
 public void GivenNullThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => DateTimeConvertor.FromIso8601FormattedDateTime(null));
 }
 public void GivenEmptyThrowsArgumnetNullException()
 {
     Assert.Throws <ArgumentNullException>(() => DateTimeConvertor.FromIso8601FormattedDateTime(string.Empty));
 }