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 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());
 }
Exemplo n.º 3
0
 public void OriginalFormTest()
 {
     string input = string.Empty; // TODO: Initialize to an appropriate value
     Command target = new Command(input); // TODO: Initialize to an appropriate value
     string expected = string.Empty; // TODO: Initialize to an appropriate value
     string actual;
     target.OriginalForm = expected;
     actual = target.OriginalForm;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 4
0
        private static List<ICommand> ReadCommands()
        {
            List<ICommand> commands = new List<ICommand>();
            bool isCommandEnd = false;

            do
            {
                string cyrrentLineCommand = Console.ReadLine();
                isCommandEnd = (cyrrentLineCommand.Trim() == "End");
                if (!isCommandEnd)
                {
                    ICommand currentCommand = new Command(cyrrentLineCommand);
                    commands.Add(currentCommand);
                }
            }
            while (!isCommandEnd);

            return commands;
        }
 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 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 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);
 }
Exemplo n.º 10
0
 public void ParametersTest()
 {
     string input = string.Empty; // TODO: Initialize to an appropriate value
     Command target = new Command(input); // TODO: Initialize to an appropriate value
     string[] expected = null; // TODO: Initialize to an appropriate value
     string[] actual;
     target.Parameters = expected;
     actual = target.Parameters;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 11
0
 public void CommandConstructorTest()
 {
     string input = string.Empty; // TODO: Initialize to an appropriate value
     Command target = new Command(input);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Exemplo n.º 12
0
 public void ParseCommandTypeTest()
 {
     string input = string.Empty; // TODO: Initialize to an appropriate value
     Command target = new Command(input); // TODO: Initialize to an appropriate value
     string commandName = string.Empty; // TODO: Initialize to an appropriate value
     CommandTypes expected = new CommandTypes(); // TODO: Initialize to an appropriate value
     CommandTypes actual;
     actual = target.ParseCommandType(commandName);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }