Example #1
0
        public void Library_AddGenre_Correct()
        {
            // Arrage
            List <Genre> genres = new List <Genre>()
            {
                new Genre()
                {
                    Id = 1, Name = "Genre0"
                },
                new Genre()
                {
                    Id = 2, Name = "Genre1"
                },
                new Genre()
                {
                    Id = 3, Name = "Genre2"
                },
            };

            Mock <IDataProvider> data = new Mock <IDataProvider>();

            data.Setup(p => p.GetGenres()).Returns(genres);

            ILibrary library  = new LibraryCollection(data.Object);
            Genre    newGenre = new Genre()
            {
                Id = 0, Name = "Genre10"
            };

            // Act
            genres.Add(newGenre);
            library.AddGenre(newGenre);

            // Assert
            Assert.Equal(genres, library.GetGenres());
        }