public async void Should_return_NoContentResult_when_Id_is_valid() { // Arrange var userId = 6; // var returnResultObject = true; var returnExpectedStatusCode = 204; //Act var result = await ControllerUnderTest.DeleteUserEmail(userId); //Assert Assert.IsType <NoContentResult>(result); var NoContentResult = Assert.IsType <NoContentResult>(result); Assert.Equal(returnExpectedStatusCode, NoContentResult.StatusCode); }
public async void Should_return_NotFoundResult_when_id_is_invalid() { // Arrange var unexistingUserId = 2; var key = "Contact_StatusCode_404_NotFound"; var localizedString = new LocalizedString(key, "Not Found"); LocalizerMock .Setup(_ => _[key]).Returns(localizedString); ContactsServiceMock .Setup(o => o.RemoveEmailAsync(unexistingUserId)) .ThrowsAsync(new ArgumentException(unexistingUserId.ToString())); // Act var result = await ControllerUnderTest.DeleteUserEmail(unexistingUserId); // Assert Assert.IsType <NotFoundObjectResult>(result); }