Exemple #1
0
        public void GetAllBooks()
        {
            // Arrange
            BookStoreController controller = new BookStoreController(_bookStoreService);

            var testTransaction = new Transaction()
            {
                BookId = 1, CustomerId = 2
            };

            var details = controller.GetAllBooks();
        }
        public void GetAllBooksTest_BookListSize()
        {
            // arrange
            int expected = 10;
            var data     = GetFakeBook(expected);

            var service = new Mock <IBookStoreService>();

            service.Setup(x => x.GetAllBooksService()).Returns(data);
            var controller = new BookStoreController(service.Object);

            // act
            int actual = controller.GetAllBooks().Count();

            // assert
            Assert.Equal(expected, actual);
        }
        public void GetAllBooksTest_BookListValue()
        {
            // arrange
            var    data     = GetFakeBook(5);
            String expected = data.First().Name;

            var service = new Mock <IBookStoreService>();

            service.Setup(x => x.GetAllBooksService()).Returns(data);
            var controller = new BookStoreController(service.Object);

            // act
            String actual = controller.GetAllBooks().First().Name;

            // assert
            Assert.Equal(expected, actual);
        }