示例#1
0
        private static void Main()
        {
            IEventsManager eventManager = new EventManager();
            var commandManager = new CommandManager(eventManager);

            while (true)
            {
                string commandInput = Console.ReadLine();

                if (commandInput == "End")
                {
                    break;
                }

                try
                {
                    Command command = Command.Parse(commandInput);
                    string commandResult = commandManager.ProcessCommand(command);
                    Console.WriteLine(commandResult);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
        public void EventManagerAddEventValidEventShouldBeAddedCorect()
        {
            var manager = new EventManager();
            manager.AddEvent(new Event("Test title", "Location", DateTime.Now));

            Assert.AreEqual(1, manager.EventsList.Count);
        }
        public void EventManagerDeleteValidParameterShouldDeleteEvent()
        {
            var manager = new EventManager();

            manager.EventsList.Add(new Event("Test title1", "Location1", new DateTime(2014, 12, 31)));
            manager.DeleteEventsByTitle("Test title1");

            Assert.AreEqual(0, manager.EventsList.Count);
        }
        public static void Main()
        {
            var eventManager = new EventManager();

            CommandExecutor cmdExecutor = new CommandExecutor(eventManager);

            var commands = ReadUserInput();
            foreach (var command in commands)
            {

                Console.WriteLine(cmdExecutor.ProcessCommand(command));
            }
        }
 public void EventManagerDeleteEventsByTitleNullParameterShouldThrow()
 {
     var manager = new EventManager();
     manager.DeleteEventsByTitle(null);
 }
 public void EventManagerAddEventWithNullShouldThrow()
 {
     var manager = new EventManager();
     manager.AddEvent(null);
 }
 public void EventManagerAddEventValidEventShouldNotThrow()
 {
     var manager = new EventManager();
     manager.AddEvent(new Event("Test title", "Location", DateTime.Now));
 }