コード例 #1
0
        public void DateRangeIsValid_StartDateCannotBeInThePast_ThrowsArgumentException(DateTime startDate, DateTime endDate)
        {
            //Object to test
            DateChecker dc = new DateChecker();

            //Test parameters
            //DateTime startDate = DateTime.Now.AddDays(-14);
            //DateTime endDate = DateTime.Today.AddDays(7);
            //Test
            Assert.Throws <ArgumentException>(() => dc.DateRangeIsValid(startDate, endDate));
        }
コード例 #2
0
        public void DateRangeIsValid_EndDateIsNotOnStartDate_ThrowsArgumentException(DateTime startDate, DateTime endDate)
        {
            //Object to test
            DateChecker dc = new DateChecker();

            //Test parameters
            //DateTime startDate = DateTime.Today.AddDays(14);
            //DateTime endDate = DateTime.Today.AddDays(14);
            //Test
            Assert.Throws <ArgumentException>(() => dc.DateRangeIsValid(startDate, endDate));
        }
コード例 #3
0
        public void DateRangeIsValid_StartdateCanBeToday_ThrowsArgumentException(DateTime startDate, DateTime endDate)
        {
            //Object to test
            DateChecker dc = new DateChecker();
            //Test parameters
            //DateTime startDate = DateTime.Today;
            //DateTime endDate = DateTime.Today.AddDays(7);
            //Test
            var actualResult   = dc.DateRangeIsValid(startDate, endDate);
            var expectedResult = true;

            Assert.Equal(expectedResult, actualResult);
        }