예제 #1
0
        public void Ctor_ValidDateParameter_Ok()
        {
            // Arrange
            DateTime date = DateTime.Now;

            // Action
            RssDate rssDate = new RssDate(date);

            // Assert
            Assert.AreEqual(date, rssDate.Date);
        }
예제 #2
0
        public void Ctor_ValidStringParameter_Ok()
        {
            // Arrange
            String date = DateTime.Now.ToString("R");

            // Action
            RssDate rssDate = new RssDate(date);

            // Assert
            Assert.AreEqual(date, rssDate.DateString);
        }
예제 #3
0
        public void SetString_StringInFuture_Error()
        {
            // Arrange
            RssDate rssDate = new RssDate();
            String date = DateTime.Now.AddDays(1).ToString("R");

            // Action
            RSSParameterException e = null;
            try
            {
                rssDate.DateString = date;
            }
            catch (RSSParameterException ex)
            {
                e = ex;
            }

            // Assert
            Assert.IsNotNull(e);
        }
예제 #4
0
        public void SetString_ValidStringParameter_Ok()
        {
            // Arrange
            RssDate rssDate = new RssDate();
            String date = DateTime.Now.ToString("R");

            // Action
            rssDate.DateString = date;

            // Assert
            Assert.AreEqual(date, rssDate.DateString);
        }
예제 #5
0
        public void SetString_InvalidDateFormat_Error()
        {
            // Arrange
            RssDate rssDate = new RssDate();
            const string InvalidDate = "adsfsadf";

            // Action
            RSSParameterException e = null;
            try
            {
                rssDate.DateString = InvalidDate;
            }
            catch (RSSParameterException ex)
            {
                e = ex;
            }

            // Assert
            Assert.IsNotNull(e);
        }
예제 #6
0
        public void SetString_Null_DateNull()
        {
            // Arrange
            RssDate rssDate = new RssDate();

            // Action
            rssDate.DateString = null;

            // Assert
            Assert.AreEqual(null, rssDate.Date);
        }
예제 #7
0
        public void SetString_ConvertToDate_Date()
        {
            // Arrange
            RssDate rssDate = new RssDate();
            DateTime date = DateTime.Now;

            // Action
            rssDate.Date = date;

            // Assert
            Assert.AreEqual(date.ToString("R"), rssDate.DateString);
        }
예제 #8
0
        public void SetDate_ValidDateParameter_Ok()
        {
            // Arrange
            RssDate rssDate = new RssDate();
            DateTime date = DateTime.Now;

            // Action
            rssDate.Date = date;

            // Assert
            Assert.AreEqual(date, rssDate.Date);
        }
예제 #9
0
        public void SetDate_DateInFuture_Error()
        {
            // Arrange
            RssDate rssDate = new RssDate();
            DateTime date = DateTime.Now.AddDays(1);

            // Action
            RSSParameterException e = null;
            try
            {
                rssDate.Date = date;
            }
            catch (RSSParameterException ex)
            {
                e = ex;
            }

            // Assert
            Assert.IsNotNull(e);
        }
예제 #10
0
        public void SetDate_ConvertToString_String()
        {
            // Arrange
            RssDate rssDate = new RssDate();
            DateTime date = DateTime.ParseExact(DateTime.Now.ToString("R"), "R", CultureInfo.InvariantCulture);

            // Action
            rssDate.DateString = date.ToString("R");

            // Assert
            Assert.AreEqual(date, rssDate.Date);
        }
예제 #11
0
        public void Ctor_ValidStringParameter_WithTimeZone_Ok()
        {
            // Arrange
            String date = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fK");

            // Action
            RssDate rssDate = new RssDate(date);

            // Assert
            Assert.AreEqual(date, rssDate.DateStringISO8601);
        }