public void AllHospitalsHttpShouldBeEmptyTest() { var mockHospitalsService = new Mock <IHospitalsService>(); var mockUserManagerService = this.GetUserManagerMock(); var mockRecipientsService = new Mock <IRecipientsService>(); var mockBloodbanksService = new Mock <IBloodBanksService>(); var mockUsersService = new Mock <IUsersService>(); var viewModel = new AllHospitalsViewModel(); var controller = new HospitalsController( mockHospitalsService.Object, mockUserManagerService.Object, mockRecipientsService.Object, mockBloodbanksService.Object, mockUsersService.Object); var result = controller.AllHospitals(viewModel); Assert.IsType <ViewResult>(result); var viewResult = result as ViewResult; Assert.IsType <AllHospitalsViewModel>(viewResult.Model); viewModel = viewResult.Model as AllHospitalsViewModel; var actualResult = viewModel.Hospitals.Count(); Assert.Equal(0, actualResult); }
public void AllHospitalsShouldReturnCorrectViewModelTest() { var mockHospitalsService = new Mock <IHospitalsService>(); var mockUserManagerService = this.GetUserManagerMock(); var mockRecipientsService = new Mock <IRecipientsService>(); var mockBloodbanksService = new Mock <IBloodBanksService>(); var mockUsersService = new Mock <IUsersService>(); var viewModel = new AllHospitalsViewModel(); var controller = new HospitalsController( mockHospitalsService.Object, mockUserManagerService.Object, mockRecipientsService.Object, mockBloodbanksService.Object, mockUsersService.Object); var result = controller.AllHospitals(viewModel); Assert.IsType <ViewResult>(result); }