Exemplo n.º 1
0
        public async Task GetAuthorsTest()
        {
            var bookTypes = new List <BookType>
            {
                new BookType()
                {
                    ID          = default(Guid),
                    Discription = "Discription 1"
                },
                new BookType()
                {
                    ID          = default(Guid),
                    Discription = "Discription 2"
                }
            };


            var fakeRepositoryMock = new Mock <IBookTypeRepository>();

            fakeRepositoryMock.Setup(x => x.getList()).ReturnsAsync(bookTypes);
            var service = new BookTypeService(fakeRepositoryMock.Object);

            var result = await service.GetList();

            Assert.Collection(result, bookType =>
            {
                Assert.Equal("Discription 1", bookType.Discription);
            },
                              bookType =>
            {
                Assert.Equal("Discription 2", bookType.Discription);
            });
        }
Exemplo n.º 2
0
        // GET: BookType
        public async Task <IActionResult> Index()
        {
            var bookTypes = await _bookTypeService.GetList();

            return(View(bookTypes));
        }