Consider the below method that updates a person and publishes an event through the PRISM EventAggregator to indicate that the person has been updated.
I would like t
I'm not an experienced unit tester so I'm not sure this is the correct unit test to write. But anyway, this is how I tested it so far and it seems to do what I want.
[Test]
public void TestPersonUpdateSendsEventWithCorrectPayload()
{
// ARRANGE
PersonUpdatedEventArgs payload = null;
_eventAggregator
.GetEvent()
.Subscribe(message => payload = message);
// ACT
_personService.UpdatePerson(5);
// ASSERT
payload.Should().NotBeNull();
payload.Id.Should().Be(5);
}
Feedback welcome.