public async void Sut_DeleteAdvisor_ShouldReturnsNotFoundResult_WhenNoAdvisorWasFound( AdvisorController sut, int id) { sut.AdvisorRepository.Any(id).Returns(false); var result = await sut.DeleteAdvisor(id); var notFoundResult = result.Result as StatusCodeResult; notFoundResult.Should().NotBeNull(); notFoundResult.Should().BeOfType <NotFoundResult>(); notFoundResult.StatusCode.Should().Be(StatusCodes.Status404NotFound); }
public async void Sut_DeleteAdvisor_ShouldReturnsOkResult_WhenTheAdvisorWasFoundAndDeleted( AdvisorController sut, int id) { sut.AdvisorRepository.Any(id).Returns(true); var result = await sut.DeleteAdvisor(id); var okResult = result.Result as StatusCodeResult; sut.AdvisorRepository.Received().DeleteAdvisor(id); await sut.AdvisorRepository.Received().SaveAsync(); okResult.Should().NotBeNull(); okResult.Should().BeOfType <OkResult>(); okResult.StatusCode.Should().Be(StatusCodes.Status200OK); }