public void SpecialtyExistsReturnsDoctorSpecialty() { //Arrange int specialtyId = 1; long doctorId = specialtyId + 1; specialtyRepository.Setup(r => r.Exists(It.IsAny <long>(), It.IsAny <int>())).ReturnsAsync( (long dId, int sId) => { return(new DoctorSpecialty { DoctorId = dId, SpecialtyId = sId }); }); //Act var result = controller.SpecialtyExists(doctorId, specialtyId).Result; //Assert Assert.IsInstanceOfType(result, typeof(DoctorSpecialty)); Assert.AreEqual(doctorId, result.DoctorId); Assert.AreEqual(specialtyId, result.SpecialtyId); }