コード例 #1
0
        public void AddEntry_DateIsValid_AddsEntry()
        {
            var entriesBefore = _databaseAccessor.FetchEntries().Count;

            _calendar.AddEntry("10/10/20 15:15", "Test description", "d");

            var entriesAfter = _databaseAccessor.FetchEntries().Count;

            Assert.Greater(entriesAfter, entriesBefore);
        }
コード例 #2
0
        public void Start()
        {
            var    calendarService = new CalendarService(this);
            string input;

            do
            {
                PrintWelcomeMessage();

                input = GetInput();
                if (input == null)
                {
                    PrintInvalidInputMessage();
                    continue;
                }

                switch (input.ToLower())
                {
                case "a":
                    do
                    {
                        calendarService.AddEntry();
                    } while (RepeatAction("Would you like to add more entries?"));
                    break;

                case "b":
                    do
                    {
                        calendarService.DeleteEntry();
                    } while (RepeatAction("Would you like to delete more entries?"));
                    break;

                case "c":
                    calendarService.GetEntriesByDateRange();
                    break;

                case "d":
                    PrintTerminationMessage();
                    break;

                default: PrintInvalidInputMessage(); continue;
                }
            } while (input?.ToLower() != "d");
        }