public void WhenValidIdSpecifiedButNoResultThenItWillThrowNotFoundException() { var query = new DeleteEmailAccount.Command { Id = int.MaxValue }; var mediator = GetService <IMediator>(); var exception = Assert.ThrowsAsync <EmailAccountNotFoundException>(() => mediator.Send(query)); Assert.That(exception, Is.Not.Null); Assert.That(exception !.Message, Is.EqualTo($"No email account with ID '{query.Id}'.")); Assert.That(exception.Entity, Is.EqualTo("accounts")); }
public void WhenValidEmailAddressSpecifiedButNoResultThenItWillThrowItemNotFoundException() { var query = new DeleteEmailAccount.Command { EmailAddress = "*****@*****.**" }; var mediator = GetService <IMediator>(); var exception = Assert.ThrowsAsync <EmailAccountNotFoundException>(() => mediator.Send(query)); Assert.That(exception, Is.Not.Null); Assert.That(exception !.Message, Is.EqualTo($"No email account with email address '{query.EmailAddress}'.")); Assert.That(exception.Entity, Is.EqualTo("accounts")); }