示例#1
0
        private static DateTime ReadDateFromConsole()
        {
            string date = null;

            do
            {
                if (date != null)
                {
                    ConsoleManager.Write("Incorrect format!");
                    Console.ReadKey();
                }

                ConsoleManager.Write("Enter a date: ");

                date = Console.ReadLine();
            }while (!DateTimeManager.IsValidDate(date));

            return(DateTime.Parse(date, new CultureInfo("pl-PL")));
        }
示例#2
0
        public void IsValidDate_IncorrectFormat_False()
        {
            bool value = DateTimeManager.IsValidDate("21.20.2001");

            Assert.IsFalse(value);
        }
示例#3
0
        public void IsValidDate_CorrectFormat_True()
        {
            bool value = DateTimeManager.IsValidDate("01.01.2012");

            Assert.IsTrue(value);
        }