Esempio n. 1
0
        public void TestMethod1()
        {
            var facade = new Mock<IBookFacade>();
            var books = new GetAllBookResponse();
            facade.Setup(x => x.GetAllBooks()).Returns(books);
            var controller = new BookController(facade.Object);

            var response = (ViewResult) controller.Index();

            facade.Verify();
        }
Esempio n. 2
0
        public GetAllBookResponse GetAllBooks()
        {
            var bookDetailsView = _bookRepository.GetAll().Select(x=>new BookDetailsView
            {
                Id = x.Id,
                BookNameBengali = x.TitleB,
                BookNameEnglish = x.TitleE,
                CategoryNameBengali = x.BookCategory.NameB,
                CategoryNameEnglish = x.BookCategory.NameE,
                CategoryId = x.BookCategoryId,
                Price = x.Price
            });

            var response = new GetAllBookResponse {BookDetails = bookDetailsView};
            return response;
        }