コード例 #1
0
        public void ParseDateShouldReturnNullWhenInputIsIncorrect()
        {
            var employeesService = new CouplesEmployees();

            string dateAsString = "text";

            string allowedFormats = "yyyy-MM-dd";

            DateTime?parsedDate = employeesService.ParseDate(dateAsString, allowedFormats);

            DateTime?result = null;

            Assert.Equal(result, parsedDate);
        }
コード例 #2
0
        public void ParseDateShouldReturnDateTimeWhenIsCorrectData()
        {
            var employeesService = new CouplesEmployees();

            string dateAsString = "2013-11-01";

            string allowedFormats = "yyyy-MM-dd";

            DateTime?parsedDate = employeesService.ParseDate(dateAsString, allowedFormats);

            DateTime?result = new DateTime(2013, 11, 1);

            Assert.Equal(result, parsedDate);
        }