public void GetSchedule_OnValidInput_returnsRepresentativesSchedule(DateTime ScheduleStartDate) { //Arrange MockRepScheduleService.Setup(m => m.CreateRepSchedule(It.IsAny <DateTime>())).Returns(Task.FromResult(_repSchedule)); RepScheduleController rep = new RepScheduleController(MockRepScheduleService.Object); //Act var response = rep.GetSchedule(ScheduleStartDate).Result as ObjectResult; //Assert Assert.AreEqual(200, response.StatusCode); }
public void GetSchedule_NullRepositoryData_returnsNotFound(DateTime ScheduleStartDate) { //Arrange _repSchedule = null; MockRepScheduleService.Setup(m => m.CreateRepSchedule(It.IsAny <DateTime>())).Returns(Task.FromResult(_repSchedule)); RepScheduleController rep = new RepScheduleController(MockRepScheduleService.Object); //Act var response = rep.GetSchedule(ScheduleStartDate).Result as ObjectResult; //Assert Assert.AreEqual(404, response.StatusCode); }
public void GetSchedule_OnInvalidInput_returnsBadRequest(DateTime ScheduleStartDate) { //Arrange Mock <IDoctorRepository> doctorRepository = new Mock <IDoctorRepository>(); Mock <IRepresentativeRepository> representativeRepository = new Mock <IRepresentativeRepository>(); Mock <IMedicineStockProvider> medicineProvider = new Mock <IMedicineStockProvider>(); IRepScheduleService repService = new RepScheduleService(doctorRepository.Object, representativeRepository.Object, medicineProvider.Object); RepScheduleController rep = new RepScheduleController(repService); //Act var response = rep.GetSchedule(ScheduleStartDate).Result as ObjectResult; //Assert Assert.AreEqual(400, response.StatusCode); }