public void ExecuteAddMovieCommandTest()
 {
     var target = new CommandExecutor();
     var catalog = new Catalog();
     var command = new Command("Add movie: The Secret; Drew Heriot, Sean Byrne & others (2006); 832763834; http://t.co/dNV4d");
     var output = new StringBuilder();
     var expected = "Movie added" + Environment.NewLine;
     target.ExecuteCommand(catalog, command, output);
     Assert.AreEqual(expected, output.ToString());
 }
 public void ExecuteAddApplicationCommandTest()
 {
     var target = new CommandExecutor();
     var catalog = new Catalog();
     var command = new Command("Add application: Firefox v.11.0; Mozilla; 16148072; http://www.mozilla.org");
     var output = new StringBuilder();
     var expected = "Application added" + Environment.NewLine;
     target.ExecuteCommand(catalog, command, output);
     Assert.AreEqual(expected, output.ToString());
 }
 public void ExecuteAddBookCommandTest()
 {
     var target = new CommandExecutor();
     var catalog = new Catalog();
     var command = new Command("Add book: Intro C#; S.Nakov; 12763892; http://www.introprogramming.info");
     var output = new StringBuilder();
     var expected = "Book added" + Environment.NewLine;
     target.ExecuteCommand(catalog, command, output);
     Assert.AreEqual(expected, output.ToString());
 }
        public static void Main()
        {
            var output = new StringBuilder();
            var cat = new Catalog();
            var commandExecutor = new CommandExecutor();

            foreach (var item in Parse())
            {
                commandExecutor.ExecuteCommand(cat, item, output);
            }

            Console.Write(output);
        }
        public static void Main()
        {
            StringBuilder output = new StringBuilder();
            Catalog catalog = new Catalog();
            ICommandExecutor ce = new CommandExecutor();

            foreach (ICommand command in Utilities.ListOfCommands())
            {
                ce.ExecuteCommand(catalog, command, output);
            }

            Console.Write(output);
        }
        public static void Main()
        {
            StringBuilder output = new StringBuilder(); 
            Catalog catalog = new Catalog();
            ICommandExecutor catalogExecutor = new CommandExecutor();

            var commands = ReadInputCommands();
            foreach (ICommand cmd in commands)
            {
                catalogExecutor.ExecuteCommand(catalog, cmd, output);
            }

            Console.Write(output);
        }
Exemple #7
0
        public static void Main()
        {
            var output = new StringBuilder();
            var catalog = new Catalog();
            ICommandExecutor c = new CommandExecutor();

            var commands = ParseCommands();
            foreach (var command in commands)
            {
                c.ExecuteCommand(catalog, command, output);
            }

            Console.Write(output);
        }
        public static void StartInteraction()
        {
            StringBuilder output = new StringBuilder();
            Catalog catalog = new Catalog();
            ICommandExecutor command = new CommandExecutor();
            IList<ICommand> commandForExecution = ReadCommands();

            foreach (ICommand item in commandForExecution)
            {
                command.ExecuteCommand(catalog, item, output);
            }

            Console.Write(output);
        }
Exemple #9
0
        public static void Main()
        {
            StringBuilder output = new StringBuilder();
            Catalog catalog = new Catalog();
            ICommandExecutor command = new CommandExecutor();

            foreach (ICommand cmd in ParseCommand())
            {
                command.ExecuteCommand(catalog, cmd, output);
            }

            Console.Write(output);
        }
 public void ExecuteAddSongCommandTest()
 {
     var target = new CommandExecutor();
     var catalog = new Catalog();
     var command = new Command("Add song: One; Metallica; 8771120; http://goo.gl/dIkth7gs");
     var output = new StringBuilder();
     var expected = "Song added" + Environment.NewLine;
     target.ExecuteCommand(catalog, command, output);
     Assert.AreEqual(expected, output.ToString());
 }
 public void CommandExecutorConstructorTest()
 {
     var target = new CommandExecutor();
     Assert.IsNotNull(target);
 }
        public void ExecuteUpdateCommandTest()
        {
            var target = new CommandExecutor();
            var catalog = new Catalog();
            var output = new StringBuilder();
            var expected = new StringBuilder();

            var command = new Command("Add book: Intro C#; S.Nakov; 12763892; http://www.introprogramming.info");
            target.ExecuteCommand(catalog, command, output);
            expected.AppendLine("Book added");

            command = new Command("Add book: Intro C# 2; S.Nakov; 12763892; http://www.introprogramming.bg");
            target.ExecuteCommand(catalog, command, output);
            expected.AppendLine("Book added");

            command = new Command("Update: http://www.introprogramming.info; http://introprograming.info/en/");
            target.ExecuteCommand(catalog, command, output);
            expected.AppendLine("1 items updated");

            Assert.AreEqual(expected.ToString(), output.ToString());
        }
        public void ExecuteFindManyCommandTest()
        {
            var target = new CommandExecutor();
            var catalog = new Catalog();
            var output = new StringBuilder();
            var expected = new StringBuilder();

            var command = new Command("Add book: Intro C#; S.Nakov; 12763892; http://www.introprogramming.info");
            target.ExecuteCommand(catalog, command, output);
            expected.AppendLine("Book added");

            command = new Command("Add book: Intro C#; S.Nakovvvvvvv; 3453454535433224; http://www.introprogramming.bg");
            target.ExecuteCommand(catalog, command, output);
            expected.AppendLine("Book added");

            command = new Command("Add movie: Movie C#; Sssssssssssss.Nakov; 5435353333; http://www.introprogramming.info");
            target.ExecuteCommand(catalog, command, output);
            expected.AppendLine("Movie added");

            command = new Command("Find: Intro C#; 1");
            target.ExecuteCommand(catalog, command, output);
            expected.AppendLine("Book: Intro C#; S.Nakov; 12763892; http://www.introprogramming.info");

            Assert.AreEqual(expected.ToString(), output.ToString());
        }
 public void ExecuteDefaultCommandTest()
 {
     var target = new CommandExecutor();
     var catalog = new Catalog();
     var command = new Command("Add car: Intro C#; S.Nakov; 12763892; http://www.introprogramming.info");
     var output = new StringBuilder();
     target.ExecuteCommand(catalog, command, output);
 }