public void GetLoansForBookTest2() { int bookId = 1; var controller = new LoansController(_entityMock.Object); var result = controller.GetLoansForBook(bookId); var objectResult = Assert.IsType <OkObjectResult>(result); var model = Assert.IsAssignableFrom <IEnumerable <LoanDTO> >(objectResult.Value); Assert.Equal(_loanDTOs.Where(l => l.Tome.BookId == 1), model); //1 ilyen kölcsönzés van, és itt nem kell dátum miatt törölni }
public void GetLoansForBookTest() { int bookId = 2; // ehhez van egy kötet és arra van két kölcsönzés var controller = new LoansController(_entityMock.Object); var result = controller.GetLoansForBook(bookId); var objectResult = Assert.IsType <OkObjectResult>(result); var model = Assert.IsAssignableFrom <IEnumerable <LoanDTO> >(objectResult.Value); Assert.Equal(_loanDTOs.Where(l => l.Tome.BookId == 2).Count() - 1, model.Count()); Assert.Equal(2, model.Count()); }