public void ServiceProviderDetails_ReturnsAViewResult() { //ARRANGE var testServiceProvider = new ServiceProviderModel { Id = 1 }; var testAppts = new List <AppointmentModel> { new AppointmentModel { Id = 1, AppointmentTime = new DateTime(2018, 12, 01, 11, 00, 00), ProviderId = 1 } }; var mockIRepo = new Mock <IRepository>(); mockIRepo.Setup(x => x.GetAppointmentsForProvider(testServiceProvider.Id)).Returns(testAppts); var testController = new ServiceProviderController(mockIRepo.Object); //ACT var result = testController.Details(1, testServiceProvider); //ASSERT Assert.IsType <ViewResult>(result); Assert.Equal(1, testServiceProvider.Id); }
public void CanServiceProviderControllerViewDetails() { //arrange var controller = new ServiceProviderController(); var testProvider = new ServiceProvider(); //act var result = controller.Details(testProvider.Id); //assert Assert.IsType <ViewResult>(result); }
public void CanServiceProviderControllerViewDetails() { //arrange var mockServRepo = new Mock <IServiceProviderRepository>(); var controller = new ServiceProviderController(mockServRepo.Object); var testProvider = new ServiceProvider(); //act var result = controller.Details(testProvider.Id); //assert Assert.IsType <ViewResult>(result); }
public void ProviderDetails_TakesAnInt_ReturnsAViewResult_WithServiceProviderModelData() { //assemble var testServiceProviderController = new ServiceProviderController(); //act var result = testServiceProviderController.Details(1); //asert var viewResult = Assert.IsType <ViewResult>(result); var model = Assert.IsAssignableFrom <ServiceProviderModel>(viewResult.ViewData.Model); Assert.NotNull(model.Name); }
public void CanCustomerControllerReturnDetailsView() { //arrange var mockServRepo = new Mock <IServiceProviderRepository>(); var mockCustRepo = new Mock <ICustomerRepository>(); var mockAppRepo = new Mock <IAppointmentRepository>(); var controller = new ServiceProviderController(mockServRepo.Object, mockCustRepo.Object, mockAppRepo.Object); var testProvider = new ServiceProvider(); //act var result = controller.Details(testProvider.Id); //assert Assert.IsType <ViewResult>(result); }
public void CanServiceProviderControllerViewDetails() { //arrange var mockServRepo = new Mock <IServiceProviderRepository>(); var mockCustRepo = new Mock <ICustomerRepository>(); var mockAppRepo = new Mock <IAppointmentRepository>(); //needed to have all repos passed in to my mock controller var controller = new ServiceProviderController(mockServRepo.Object, mockCustRepo.Object, mockAppRepo.Object); var testProvider = new ServiceProvider(); //act var result = controller.Details(testProvider.Id); //assert Assert.IsType <ViewResult>(result); }