public BorrowerController CreateAndReturnBorrowerControllerObject() { var mockRepository = new FakeBorrowerRepository(); var mockBorrowerService = new FakeBorrowerService(new ModelStateWrapper(), mockRepository); var controller = new BorrowerController(mockBorrowerService); return(controller); }
public void BookBorrow_Get_Action_Returns_Empty_ViewResult_When_No_Books() { //Arrange var repository = new FakeBorrowerRepository(); repository.context.Books.Clear(); var modelState = new Mock <IValidationDictionary>(); var mockBorrowerService = new FakeBorrowerService(modelState.Object, repository); var controller = new BorrowerController(mockBorrowerService); //Act var result = controller.BookBorrow() as ViewResult; //Assert Assert.AreEqual("Empty", result.ViewName); }