public void ContentConstructorTest() { ContentTypes types = new ContentTypes(); // TODO: Initialize to an appropriate value string[] commandParams = null; // TODO: Initialize to an appropriate value Content target = new Content(types, commandParams); Assert.Inconclusive("TODO: Implement code to verify target"); }
public void AddTest() { var target = new Catalog(); var content = new Content(ContentTypes.Book, "Intro C#; S.Nakov; 12763892; http://www.introprogramming.info".Split(';')); target.Add(content); Assert.AreEqual(1, target.Count); }
public void CompareToTest() { ContentTypes types = new ContentTypes(); // TODO: Initialize to an appropriate value string[] commandParams = null; // TODO: Initialize to an appropriate value Content target = new Content(types, commandParams); // TODO: Initialize to an appropriate value object obj = null; // TODO: Initialize to an appropriate value int expected = 0; // TODO: Initialize to an appropriate value int actual; actual = target.CompareTo(obj); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void AuthorTest() { ContentTypes types = new ContentTypes(); // TODO: Initialize to an appropriate value string[] commandParams = null; // TODO: Initialize to an appropriate value Content target = new Content(types, commandParams); // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; target.Author = expected; actual = target.Author; Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void TestMethod_AddSingleItemAndCheckContent() { Catalog catalog = new Catalog(); Content book = new Content(ContentType.Book, new string[] {"Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info"}); catalog.Add(book); var result = catalog.GetListContent("Intro C#", 1); Assert.AreEqual(result.Count(), 1); Assert.AreSame(result.First(), book); }
public void TestMethod_AddDuplicatedItem() { Catalog catalog = new Catalog(); Content book1 = new Content(ContentType.Book, new string[] {"Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info"}); catalog.Add(book1); catalog.Add(book1); Content book2 = new Content(ContentType.Book, new string[] {"Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info"}); catalog.Add(book2); Assert.AreEqual(3, catalog.Count); }
public void TestMethod_AddMultipleItem() { Catalog catalog = new Catalog(); Content book1 = new Content(ContentType.Book, new string[] {"Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info"}); catalog.Add(book1); Content movie = new Content(ContentType.Book, new string[] {"Java Movie", "S.sssss", "12755892", "http://www.introprogramming.com"}); catalog.Add(movie); Content song = new Content(ContentType.Book, new string[] {"Java song", "S.sssss", "12755892", "http://www.introprogramming.bg"}); catalog.Add(song); Assert.AreEqual(3, catalog.Count); }
public void ExecuteCommand(ICatalog catalog, ICommand cmd, StringBuilder output) { switch (cmd.Type) { case CommandType.AddBook: catalog.Add(new Content(ContentType.Book, cmd.Parameters)); output.AppendLine("Book added"); break; case CommandType.AddMovie: var item = new Content(ContentType.Movie, cmd.Parameters); catalog.Add(item); output.AppendLine("Movie added"); break; case CommandType.AddSong: catalog.Add(new Content(ContentType.Song, cmd.Parameters)); output.AppendLine("Song added"); break; case CommandType.AddApplication: catalog.Add(new Content(ContentType.Application, cmd.Parameters)); output.AppendLine("Application added"); break; case CommandType.Update: ProcessUpdateCommand(catalog, cmd, output); break; case CommandType.Find: ProcessFindCommand(catalog, cmd, output); break; default: throw new ArgumentException("Unknown command!"); } }
private void Add(ContentType contentType, ICommand command, ICatalog contentCatalog, StringBuilder output) { IContent currentBook = new Content(contentType, command.Parameters); contentCatalog.Add(currentBook); output.AppendLine(contentType + " added"); }
public void TestMethod_Add10000Item() { Catalog catalog = new Catalog(); for (int i = 0; i < 10000; i++) { Content book1 = new Content(ContentType.Book, new string[] {"Intro C#" + (i%5), "S.Nakov", "12763892", "http://www.introprogramming.info"}); catalog.Add(book1); } Assert.AreEqual(10000, catalog.Count); }
public void TestMethod_GetListContentCheckOrder() { Catalog catalog = new Catalog(); Content book = new Content(ContentType.Book, new string[] {"Intro movie", "S.fdr", "12763892", "http://www.introprogramming.bg"}); catalog.Add(book); Content movie = new Content(ContentType.Movie, new string[] {"Intro movie", "S.fd", "12763892", "http://www.bg.info"}); catalog.Add(movie); Content app = new Content(ContentType.Application, new string[] {"Intro movie", "Sfdv", "12763892", "http://www.bg.info"}); catalog.Add(app); Content book1 = new Content(ContentType.Book, new string[] {"Intro movie", "dd", "12763892", "http://www.introprogramming.bg"}); catalog.Add(book1); var result = catalog.GetListContent("Intro movie", 10); Assert.AreEqual(result.Count(), 4); string[] expected = { "Application: Intro movie; Sfdv; 12763892; http://www.bg.info", "Book: Intro movie; dd; 12763892; http://www.introprogramming.bg", "Book: Intro movie; S.fdr; 12763892; http://www.introprogramming.bg", "Movie: Intro movie; S.fd; 12763892; http://www.bg.info" }; string[] actual = new string[] { result.First().ToString(), result.Skip(1).First().ToString(), result.Skip(2).First().ToString(), result.Skip(3).First().ToString() }; CollectionAssert.AreEqual(expected, actual); }
public void TestMethod_GetListContentMissingItem() { Catalog catalog = new Catalog(); Content book = new Content(ContentType.Book, new string[] {"Intro C#", "S.Nakov", "12763892", "http://www.introprogrammi ng.bg"}); catalog.Add(book); Content movie = new Content(ContentType.Movie, new string[] {"Intro movie", "S.Nakov", "12763892", "http://www.bg.info"}); catalog.Add(movie); Content app = new Content(ContentType.Application, new string[] {"Intro movie", "S.Nakov", "12763892", "http://www.bg.info"}); catalog.Add(app); var result = catalog.GetListContent("Missing item", 10); Assert.AreEqual(result.Count(), 0); }