public void AddSingleItemTest() { string[] commandParams = {"Firefox v.11.0","Mozilla","16148072","http://www.mozilla.org"}; Content testContent = new Content(ContentType.Application, commandParams); Catalog testCatalog = new Catalog(); testCatalog.Add(testContent); int result = testCatalog.Count; Assert.AreEqual(1, result); }
public void GetListContentSingleItemTest() { string[] commandParams = { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" }; Content testContent = new Content(ContentType.Application, commandParams); Catalog testCatalog = new Catalog(); testCatalog.Add(testContent); IEnumerable<IContent> resultList = testCatalog.GetListContent("Firefox v.11.0", 2); Assert.AreEqual(1, resultList.Count()); Assert.AreSame(testContent, resultList.First()); }
public static void Main() { StringBuilder output = new StringBuilder(); Catalog catalog = new Catalog(); ICommandExecutor commandExecutor = new CommandExecutor(); var CommandsList = CommandParser(); foreach (ICommand command in CommandsList) { commandExecutor.ExecuteCommand(catalog, command, output); } Console.Write(output); //printing the output }
public static void Main() { StringBuilder output = new StringBuilder(); Catalog catalog = new Catalog(); ICommandExecutor commandExecutor = new CommandExecutor(); List<ICommand> inputCommands = ReadInput(); foreach (ICommand command in inputCommands) { commandExecutor.ExecuteCommand(catalog, command, output); } // Console.BackgroundColor = ConsoleColor.DarkGreen; Console.Write(output); // printing the output }
public void AddMultipleItemTest() { Catalog testCatalog = new Catalog(); string[] commandParams = { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" }; Content testContent = new Content(ContentType.Application, commandParams); testCatalog.Add(testContent); string[] commandParams2 = { "TheMatrix", "Wasovski brothers", "18072", "http://www.imdb.com" }; Content testContent2 = new Content(ContentType.Movie, commandParams); testCatalog.Add(testContent); string[] commandParams3 = { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" }; Content testContent3 = new Content(ContentType.Book, commandParams); testCatalog.Add(testContent); string[] commandParams4 = { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }; Content testContent4 = new Content(ContentType.Song, commandParams); testCatalog.Add(testContent); int result = testCatalog.Count; Assert.AreEqual(4, result); }
public void UpdateContentTest() { ICatalog catalog = new Catalog(); catalog.Add(new Content(ContentType.Book, new string[]{"Intro c#", "S.Nakov", "12763892", "http://www.introprogramming.info"})); catalog.Add(new Content(ContentType.Application, new string[]{"Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org"})); catalog.Add(new Content(ContentType.Song, new string[]{"One", "Metallica", "8771120", "http://goo.gl/dIkth7gs"})); catalog.Add(new Content(ContentType.Movie, new string[]{"The Secret", "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://t.co/dNV4d"})); catalog.Add(new Content(ContentType.Movie, new string[]{"One", "James Wong (2001)", "969763002", "http://www.imdb.com/title/tt0267804/"})); int updated = catalog.UpdateContent("http://www.introprogramming.info", "http://introprograming.info/en/"); Assert.AreEqual(1, updated); }
public void GetListContetnTest() { ICatalog catalog = new Catalog(); catalog.Add(new Content(ContentType.Book, new string[]{"Intro c#", "S.Nakov", "12763892", "http://www.introprogramming.info"})); catalog.Add(new Content(ContentType.Application, new string[]{"Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org"})); catalog.Add(new Content(ContentType.Song, new string[]{"One", "Metallica", "8771120", "http://goo.gl/dIkth7gs"})); catalog.Add(new Content(ContentType.Movie, new string[]{"The Secret", "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://t.co/dNV4d"})); catalog.Add(new Content(ContentType.Movie, new string[]{"One", "James Wong (2001)", "969763002", "http://www.imdb.com/title/tt0267804/"})); var list = catalog.GetListContent("Intro c#", 1).GetEnumerator(); IContent expected = new Content(ContentType.Book, new string[]{"Intro c#", "S.Nakov", "12763892", "http://www.introprogramming.info"}); list.MoveNext(); Assert.IsTrue(expected.CompareTo(list.Current) == 0); }