Skip to content

Instantly share code, notes, and snippets.

@obegendi
Created July 21, 2019 16:38
Show Gist options
  • Save obegendi/14a63e9e5b5a1500378f2ef5101a56e3 to your computer and use it in GitHub Desktop.
Save obegendi/14a63e9e5b5a1500378f2ef5101a56e3 to your computer and use it in GitHub Desktop.
[Fact]
public void SendMessageToAlertQueueWhenIsValidException()
{
//Arrange
Mock<IValidator> mockValidator
= new Mock<IValidator>();
mockValidator.Setup(x => x.ServiceStatus).Returns(Status.NotOK);
mockValidator.Setup(x => x.IsValid(It.IsAny<string>()))
.Throws(new Exception("Some exception Message"))
.Raises(x => x.PublishToQueue += null, EventArgs.Empty);;
var sut = new CreditApplicationEvaluator(mockValidator.Object);
var application = new CreditApplication { Age = 42 };
//Act
CreditApplicationDecision decision = sut.Evaluate(application);
//mockValidator.Raise(x => x.PublishToQueue += null, EventArgs.Empty);
//Assert
Assert.Equal(1, sut.ValidatorQueueEvent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment