public void Errors_compensated_for_are_rethrown()
        {
            var operation = new FakeOperation {
                ThrowOnExecute = new Exception()
            };
            var sut = new CompensatingOperationBehavior(new FakeOperation());

            sut.AttachTo(operation);

            Assert.Throws <Exception>(() => sut.Execute());
        }
        public void When_no_error_occurs_in_the_operation_the_compensating_operation_is_not_executed()
        {
            var operation             = new FakeOperation();
            var compensatingOperation = new FakeOperation();
            var sut = new CompensatingOperationBehavior(compensatingOperation);

            sut.AttachTo(operation);

            sut.Execute();

            Assert.False(compensatingOperation.HasExecuted);
        }