public void Update_ModelIsValid_ReturnsOK() { //Arrange _answerService.Setup(s => s.UpdateEntity(_answer)); //Act var actionResult = _answerController.Update(_answer).Result as OkResult; //Assert actionResult.StatusCode.Should().Be(200); }
public async Task GivenAnswer_WhenUpdate_ThenCreatedSuccessful() { //?Given var answerModel = new AnswerModel(); var answer = new Answer(); _mockMapper.Setup(x => x.Map <Answer>(answerModel)) .Returns(answer) .Verifiable(); _mockManager.Setup(x => x.Update(answer)) .Verifiable(); //?When var result = await _answerController.Update(answerModel); //?Then Assert.IsType <OkResult>(result); _mockMapper.Verify(); _mockManager.Verify(); }