Exemplo n.º 1
0
        public string ShowRange(string start, string finish)
        {
            var startTime  = DateTime.Parse(start);
            var finishTime = DateTime.Parse(finish);

            var checker = CheckRange(startTime, finishTime);
            var message = "";

            switch (checker)
            {
            case DateEnum.Years:
                message = new YearPrinter().Print(startTime, finishTime);
                break;

            case DateEnum.Months:
                message = new MonthPrinter().Print(startTime, finishTime);
                break;

            case DateEnum.Days:
                message = new DayPrinter().Print(startTime, finishTime);
                break;
            }

            return(message);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            YearPrinter printer = new YearPrinter();
            // Fehlerbehandlung, falls args[] leer ist.
            string firstArgument  = "";
            string secondArgument = "";

            try
            {
                firstArgument  = args[0];
                secondArgument = args[1];
            }
            catch (System.IndexOutOfRangeException)
            { }
            CommandLineParser clParser = new CommandLineParser(firstArgument, secondArgument);

            // Konsolenausgabe des Jahres.
            printer.PrintYear(new Year(clParser.Year, clParser.WeekStartday));
        }
Exemplo n.º 3
0
        public void Should_Return_Dates_In_String(string startDate, string finishDate, string testResult)
        {
            var result = new YearPrinter().Print(DateTime.Parse(startDate), DateTime.Parse(finishDate));

            Assert.AreEqual(result, testResult);
        }