예제 #1
0
        public void get_books_returns_all_available_books()
        {
            //given
            moqBookService.Setup(m => m.GetAllBooks()).Returns(TestData.Books);

            var sut = new BookStoreService(moqStudentService.Object, moqBookService.Object, moqBookAllocationService.Object);

            //when
            var result = sut.GetAllBooks();

            //then

            Assert.IsInstanceOfType(result, typeof(IEnumerable <Book>));
            Assert.AreEqual(TestData.Books.Count, result.Count());
            moqBookService.Verify(v => v.GetAllBooks(), Times.Once);
        }