public void ScheduleMeetingController_GetMeetingStartDate(DateTime startdate) { schedulepro.Setup(s => s.GetRepScheduleAsync(startdate)).Returns(Task.FromResult(new List <RepSchedule>())); var pro = new RepScheduleController(schedulepro.Object); ObjectResult data = pro.Get(startdate).Result as ObjectResult; Assert.AreEqual(404, data.StatusCode); }
public void GetByDateFailTestController() { var mock = new Mock <IRepScheduleRepository>(); mock.Setup(x => x.Get("token")).Returns(medicinestock); RepScheduleProvider prov = new RepScheduleProvider(mock.Object); DateTime date = new DateTime(2020, 05, 24); RepScheduleController repcon = new RepScheduleController(prov); var data = repcon.Get(date); var result = data as ObjectResult; Assert.AreEqual(400, result.StatusCode); }
public void TestControllerLayerCorrectInput(DateTime startdate) { schedulepro.Setup(m => m.GetRepScheduleAsync(It.IsAny <DateTime>())).Returns(Task.FromResult(new List <RepSchedule>() { new RepSchedule { RepName = "R1", DoctorName = "D1", DateOfMeeting = "12-12-2020", DoctorContactNumber = 9099687, Medicine = "Aspirin", MeetingSlot = "1-2pm", TreatingAilment = "General" } })); var pro = new RepScheduleController(schedulepro.Object); var res = pro.Get(startdate).Result as ObjectResult; Assert.AreEqual(res.StatusCode, 200); }