public void Update_Valid_Detail() { Doctor doc = new Doctor { Name = "Dummy 3", Email = "DD", Password = "******" }; DoctorRep res = new DoctorRep(db); DoctorsController obj = new DoctorsController(res); var data = obj.Put(1, doc); var okResult = data as OkObjectResult; Assert.AreEqual(200, okResult.StatusCode); }
public void PutReturnsDoctor() { //Arrange repository.Setup(r => r.Put(It.IsAny <Doctor>())).ReturnsAsync((Doctor doctor) => { return(doctor); }); long doctorId = 1; //Act var result = (controller.Put(doctorId, new Doctor { Id = doctorId }).Result as OkObjectResult).Value; //Assert Assert.IsInstanceOfType(result, typeof(Doctor)); Assert.AreEqual(doctorId, (result as Doctor)?.Id); }