[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(); result.As() .Value.Should().Be("Person has invalid state"); this._repository.Verify(r => r.Add(It.IsAny()), Times.Never); }