Created
May 19, 2019 14:57
-
-
Save johanvergeer/a0d88a8857827cdc7d7ff9c23d698beb to your computer and use it in GitHub Desktop.
Revisions
-
johanvergeer created this gist
May 19, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ [Fact] public void Post_PersonWithoutName_PersonNotSaved() { // Create new person, without a name, which will not be accepted by the controller var person = new Person(); // Create new controller with mock repository var controller = new PersonController(this._repository.Object); // Call controller to post person var result = controller.Post(person); // Assert result.Should().BeOfType<BadRequestObjectResult>(); result.As<BadRequestObjectResult>() .Value.Should().Be("Person has invalid state"); this._repository.Verify(r => r.Add(It.IsAny<Person>()), Times.Never); }