예제 #1
0
        public void Get_Returns_Specific_Book()
        {
            // Arrange
            LibraryContextMock   mockContext = new LibraryContextMock();
            FilledBookRepository repo        = new FilledBookRepository(mockContext);
            Book newBook1 = new Book()
            {
                id = 0, title = "Test1"
            };
            Book newBook2 = new Book()
            {
                id = 1, title = "Test2"
            };

            repo.Add(newBook1);
            repo.Add(newBook2);

            // Act
            Book book = repo.Get(1);

            // Asert
            Assert.Equal(newBook2, book);
        }
        public void Get_Returns_Specific_Book()
        {
            // Arrange
            buildBooks();
            FilledBookRepository repo = new FilledBookRepository(starterBooks);
            Book newBook = new Book()
            {
                Title = "Test" + starterBooks.Count
            };
            Book newNewBook = new Book()
            {
                Title = "Test" + (starterBooks.Count + 1)
            };

            repo.Add(newBook);
            repo.Add(newNewBook);

            // Act
            Book book = repo.Get(starterBooks.Count);

            // Asert
            Assert.Equal(newBook, book);
        }