Ejemplo n.º 1
0
        public void TestAddMultipleSameContentItems()
        {
            Catalog catalog = new Catalog();
            Content contentBook = new Content(ContentType.Book, 
                new string[] 
                {
                    "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info"
                });
            Content contentBook2 = new Content(ContentType.Book, 
                new string[]
                {
                    "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info"
                });
            Content contentBook3 = new Content(ContentType.Movie, 
                new string[]
                {
                    "Leonardo ciffer", "Dan Brown", "23922539", "http://www.introprogramming.info"
                });
            catalog.Add(contentBook);
            catalog.Add(contentBook3);
            catalog.Add(contentBook2);

            Assert.AreEqual(3, catalog.Count);
            //Count returns 2. I don't know why.
            // MultiDictionary Count Summary:
            //     Gets the number of key-value pairs in the dictionary. Each value associated
            //     with a given key is counted. If duplicate values are permitted, each duplicate
            //     value is included in the count.
        }
Ejemplo n.º 2
0
        public void TestAddSingleContentItem()
        {
            Catalog catalog = new Catalog();
            Content content = new Content(ContentType.Book, new string[] {"Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info"});
            catalog.Add(content);

            Assert.AreEqual(1, catalog.Count);
        }
Ejemplo n.º 3
0
        public void TestAddMultipleDifferentContentItems()
        {
            Catalog catalog = new Catalog();
            Content contentBook = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
            Content contentMovie = new Content(ContentType.Movie, new string[] { "Fast and Furious", "American Movies", "92752320", "http://www.fastandfurious.com" });
            catalog.Add(contentBook);
            catalog.Add(contentMovie);

            Assert.AreEqual(2, catalog.Count);
        }
Ejemplo n.º 4
0
        public void TestAddWithOneObjectAddedThreeTimes()
        {
            Catalog catalog = new Catalog();
            Content contentBook = new Content(ContentType.Book,
                new string[] 
                {
                    "Intro C#", "S.Nakova", "12763892", "http://www.introprogramming.info"
                });
            catalog.Add(contentBook);
            catalog.Add(contentBook);
            catalog.Add(contentBook);

            Assert.AreEqual(3, catalog.Count);
            //Count returns 1. I don't know why.
            // MultiDictionary Count Summary:
            //     Gets the number of key-value pairs in the dictionary. Each value associated
            //     with a given key is counted. If duplicate values are permitted, each duplicate
            //     value is included in the count.
        }
 private void ExecuteCommandAddBook(ICommand command, ICatalog catalog, StringBuilder sb)
 {
     var book = new Content(ContentType.Book, command.Parameters);
     catalog.Add(book);
     sb.AppendLine("Book Added");
 }
 private void ExecuteCommandAddMovie(ICommand command, ICatalog catalog, StringBuilder sb)
 {
     var movie = new Content(ContentType.Movie, command.Parameters);
     catalog.Add(movie);
     sb.AppendLine("Movie added");
 }
 private void ExecuteCommandAddSong(ICommand command, ICatalog catalog, StringBuilder sb)
 {
     var song = new Content(ContentType.Song, command.Parameters);
     catalog.Add(song);
     sb.AppendLine("Song added");
 }
 private void ExecuteCommandAddApplication(ICommand command, ICatalog catalog, StringBuilder sb)
 {
     var application = new Content(ContentType.Application, command.Parameters);
     catalog.Add(application);
     sb.AppendLine("Application added");
 }