Skip to content

Commit

Permalink
add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
JuergenGutsch committed Dec 7, 2017
1 parent cb53afc commit 53e81b6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions WebApiDemo.Tests/PersonsControllerUnitTests.cs
Expand Up @@ -139,6 +139,25 @@ public async Task Persons_Delete()
AssertionExtensions.ShouldThrow<InvalidOperationException>(
() => service.Get(20));
}


[Fact]
public async Task Persons_Delete_Fail()
{
// Arrange
var service = new PersonService();
var controller = new PersonsController(service);

// Act
var result = await controller.Delete(20);

// Assert
var okResult = result.Should().BeOfType<NoContentResult>().Subject;
// should throw an eception,
// because the person with id==20 doesn't exist enymore
AssertionExtensions.ShouldThrow<InvalidOperationException>(
() => service.Get(15));
}
}
}

0 comments on commit 53e81b6

Please sign in to comment.