Exemplo n.º 1
0
        public void IsValid_OnInValidDate_ReturnsFalse(DateTime ScheduleStartDate, bool ExpectedResult)
        {
            //Arrange
            IRepScheduleService repService = new RepScheduleService(doctorRepository.Object, representativeRepository.Object, medicineProvider.Object);
            //Act
            var response = repService.IsValid(ScheduleStartDate);

            //Assert
            Assert.AreEqual(response, ExpectedResult);
        }
Exemplo n.º 2
0
        public void CreateRepSchedule_OnProvidingValidObject_ReturnsRepScheduleList(DateTime ScheduleStartDate)
        {
            //Arrange
            IRepScheduleService repService = new RepScheduleService(doctorRepository.Object, representativeRepository.Object, medicineProvider.Object);
            //Act
            var response = repService.CreateRepSchedule(ScheduleStartDate).Result;

            //Assert
            Assert.IsNotNull(response);
        }
Exemplo n.º 3
0
        public void CreateRepSchedule_onInvalidInput_ThrowsArgumentException(DateTime ScheduleStartDate)
        {
            //Arrange
            IRepScheduleService repService = new RepScheduleService(doctorRepository.Object, representativeRepository.Object, medicineProvider.Object);
            //Act
            var result = Assert.ThrowsAsync <ArgumentException>(() => repService.CreateRepSchedule(ScheduleStartDate));

            //Assert
            Assert.That(result.Message, Is.EqualTo("InValid date"));
        }
        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);
        }