public void Should_dispose_and_throw_the_generated_exception_if_the_action_fails() { InputEntity1 input1 = new InputEntity1(); InputEntity2 input2 = new InputEntity2(); Assert.Throws <Exception>( () => _atomicRequestHandler.Invoke <InputEntity1, InputEntity2, InputEntity1>(input1, input2, Failure)); sessionContainer.AssertWasNotCalled(x => x.Commit()); sessionContainer.AssertWasCalled(x => x.Dispose()); }
public void Should_commit_if_the_action_was_success() { InputEntity1 input1 = new InputEntity1(); InputEntity2 input2 = new InputEntity2(); _atomicRequestHandler.Invoke <InputEntity1, InputEntity2, InputEntity1>(input1, input2, Success); sessionContainer.AssertWasCalled(x => x.Commit()); sessionContainer.AssertWasCalled(x => x.Dispose()); }
public InputEntity1 Failure(InputEntity1 entity1, InputEntity2 entity2) { throw new Exception(); }
public InputEntity1 Success(InputEntity1 entity1, InputEntity2 entity2) { return(entity1); }
public void Should_commit_if_the_action_was_success() { InputEntity1 input1 = new InputEntity1(); InputEntity2 input2 = new InputEntity2(); _atomicRequestHandler.Invoke<InputEntity1, InputEntity2, InputEntity1>(input1, input2, Success); sessionContainer.AssertWasCalled(x => x.Commit()); sessionContainer.AssertWasCalled(x => x.Dispose()); }
public InputEntity1 Failure(InputEntity1 entity1, InputEntity2 entity2) { throw new Exception(); }
public InputEntity1 Success(InputEntity1 entity1, InputEntity2 entity2) { return entity1; }
public void Should_dispose_and_throw_the_generated_exception_if_the_action_fails() { InputEntity1 input1 = new InputEntity1(); InputEntity2 input2 = new InputEntity2(); Assert.Throws<Exception>( () => _atomicRequestHandler.Invoke<InputEntity1, InputEntity2, InputEntity1>(input1, input2, Failure)); sessionContainer.AssertWasNotCalled(x => x.Commit()); sessionContainer.AssertWasCalled(x => x.Dispose()); }