public void EditDiplomaReturnsDiploma() { //Arrange diplomaRepository.Setup(d => d.Put(It.IsAny <Diploma>())).ReturnsAsync((Diploma d) => { return(d); }); diplomaRepository.Setup(d => d.Exists(It.IsAny <object[]>())).ReturnsAsync(true); long doctorId = 1; long diplomaId = doctorId + 1; //Act var result = (controller.EditDiploma(doctorId, diplomaId, new Diploma { Id = diplomaId, DoctorId = doctorId }).Result as OkObjectResult).Value; //Assert Assert.IsInstanceOfType(result, typeof(Diploma)); Assert.AreEqual(doctorId, (result as Diploma)?.DoctorId); Assert.AreEqual(diplomaId, (result as Diploma)?.Id); }