public async Task Verify_AddAndUpdateDummySurvey() { // Arrange string surveyName = "Survey 4"; int surveyId = 4; Survey sample_survey = GetSurvey(); Survey updated_survey = sample_survey; updated_survey.Name = "Updated survey 4"; var mockRepo = new Mock <CompassDBContext>(); mockRepo.SetupAllProperties(); mockRepo.Setup(repo => repo.GetSurveyAsync(surveyId)) .ReturnsAsync(sample_survey); mockRepo.Setup(repo => repo.UpdateSurveyAsync(surveyId, sample_survey)) .Returns(Task.CompletedTask).Verifiable(); var controller = new SurveysController(mockRepo.Object); // Act var result = await controller.PostSurvey(sample_survey); // Assert var okResult = Assert.IsType <CreatedAtActionResult>(result); var returnSession = Assert.IsType <Survey>(okResult.Value); //Act sample_survey.Name = "Updated survey 4"; var updateResult = await controller.PutSurvey(surveyId, sample_survey); var okUpdateResult = Assert.IsType <OkObjectResult>(updateResult); var updatedSurveyObject = Assert.IsType <Survey>(okUpdateResult.Value); Assert.Equal(updated_survey.Name, updatedSurveyObject.Name); }