コード例 #1
0
        public void ShouldMatchItsOptionAsString()
        {
            Func<DateSpan, string, Todo> todoEventFactory = Substitute.For<Func<DateSpan, string, Todo>>();
            IPlanner planner = Substitute.For<IPlanner>();

            AddTodoOption addTodoOption = new AddTodoOption(todoEventFactory, planner);
            bool result = addTodoOption.MatchesString(AddTodoOption.AddToDoOptionString);
            Assert.IsTrue(result);
        }
コード例 #2
0
        public void ShouldMatchItsOptionAsString()
        {
            ITodoFactory todoEventFactory = Substitute.For<ITodoFactory>();
              ILogger logger = Substitute.For<ILogger>();
              IPlanner planner = Substitute.For<IPlanner>();

              AddTodoOption addTodoOption = new AddTodoOption(todoEventFactory, planner, logger);
              bool result = addTodoOption.MatchesString(AddTodoOption.AddToDoOptionString);
              Assert.IsTrue(result);
        }
コード例 #3
0
        static void Main()
        {
            using (Logger logger = new Logger())
              {
            IEventsRepository eventsRepository = new EventsRepository("calendarData.dat");
            IAddPolicy shareableSchedulePolicy = new ShareableSchedulePolicy(eventsRepository);
            IAddPolicy exclusiveSchedulePolicy = new ExclusiveSchedulePolicy(eventsRepository);

            Planner planner = new Planner(eventsRepository, shareableSchedulePolicy, exclusiveSchedulePolicy);

            IMeetingFactory meetingFactory = new MeetingFactory();
            IOption addMeetingOption = new AddMeetingOption(meetingFactory, planner, logger);

            ITodoFactory todoFactory = new TodoFactory();
            IOption addTodoOption = new AddTodoOption(todoFactory, planner, logger);

            IOption listEventsOption = new ListEventsOption(planner);

            IOption endApplicationOption = new EndApplicationOption();

            OptionsDispatcher optionsDispatcher = new OptionsDispatcher(new[]
              {
            addTodoOption,
            addMeetingOption,
            listEventsOption,
            endApplicationOption,
              },
              Console.In,
              logger);

            bool result = true;
            while (result)
            {
              result = optionsDispatcher.ChooseOptionAndRun();
            }
              }
        }