public void When_no_compensating_action_is_triggered_no_event_is_logged(FakeWorkflowLogger log) { var operation = new FakeOperation { ThrowOnExecute = new Exception() }; var compensatingOperation = new FakeOperation(); var sut = new CompensatingOperationBehavior(compensatingOperation, typeof(ArgumentException)); sut.AttachTo(operation); sut.Initialize(new FakeWorkflowConfiguration { Logger = log }); ExecuteIgnoringErrors(sut.Execute); Assert.Equal(0, log.AppliedBehaviors.Count); }
public void Executing_a_compensating_operation_logs_an_event(FakeWorkflowLogger log) { var operation = new FakeOperation { ThrowOnExecute = new ArgumentException() }; var compensatingOperation = new FakeOperation(); var sut = new CompensatingOperationBehavior(compensatingOperation, typeof(Exception)); sut.AttachTo(operation); sut.Initialize(new FakeWorkflowConfiguration { Logger = log }); ExecuteIgnoringErrors(sut.Execute); Assert.Equal(1, log.AppliedBehaviors.Count); Assert.Equal("Executing compensating operation", log.AppliedBehaviors[0].Description); }