Ejemplo n.º 1
0
        public void TestDayName(DateTime now)
        {
            string dateString = null;
            string dayName = null;

            Assert.DoesNotThrow(() => dateString = now.ToRFC822String());

            Assert.DoesNotThrow(() => dayName = dateString.Substring(0, dateString.IndexOf(',')));
            Assert.True(RFC822DateFacts.DayNames.Contains(dayName));
        }
Ejemplo n.º 2
0
 public void Utils_RFC822String()
 {
     var date = new DateTime(2015, 08, 29, 23, 01, 45, DateTimeKind.Utc);
     var result = date.ToRFC822String();
     Assert.AreEqual("Sat, 29 Aug 2015 23:01:45", result);
 }
Ejemplo n.º 3
0
        public void TestZone(DateTime now)
        {
            string dateString = null;

            Assert.DoesNotThrow(() => dateString = now.ToRFC822String());
            Console.WriteLine(dateString);
            int indexOfDash = -1;
            Assert.DoesNotThrow(() => indexOfDash = dateString.LastIndexOf('-'));
            if (indexOfDash == -1)
            {
                indexOfDash = dateString.LastIndexOf('+');
            }
            Assert.True(indexOfDash >= 0);

            // Verify there is no colon after the dash or plus
            Assert.True(dateString.IndexOf(':', indexOfDash) < 0);
        }
Ejemplo n.º 4
0
        public void TestMonth(DateTime now)
        {
            string dateString = null;

            Assert.DoesNotThrow(() => dateString = now.ToRFC822String());
            Assert.True(this.FindMonth(dateString));
        }
Ejemplo n.º 5
0
 public void TestDateSerialization(DateTime now)
 {
     string dateString = null;
     Assert.DoesNotThrow(() => dateString = now.ToRFC822String());
     Assert.True(!string.IsNullOrEmpty(dateString));
 }