public void AtomicOperationShouldThrowExceptionOnExecuteIfNoExecutionHandlerSpecified() { var operation = new AtomicOperation(); var result = operation.Execute(); Assert.That(result.Succeeded, Is.True); Assert.That(result.Message, Is.Empty); }
public void AtomicOperationShouldReturnSuccessResultFromRollbackIfNoRollbackHandlerSpecified() { var operation = new AtomicOperation(); var result = operation.Rollback(); Assert.That(result.Succeeded, Is.True); Assert.That(result.Message, Is.Empty); }
public virtual bool isApplicableForOperation(AtomicOperation operation) { foreach (string identifier in operationIdentifier) { if (operation.CanonicalName.Equals(identifier)) { return(true); } } return(false); }
public void AtomicOperationShouldHandleUnhandledExceptionsInHandlersAndConsiderItAFailedOperationWithExceptionMessage() { var operation = new AtomicOperation() { ExecutionHandler = () => { throw new Exception("execution");}, RollbackHandler = () => { throw new Exception("rollback");} }; var executionResult = operation.Execute(); Assert.That(executionResult.Succeeded, Is.False); Assert.That(executionResult.Message, Is.EqualTo("execution")); var rollbackResult = operation.Rollback(); Assert.That(rollbackResult.Succeeded, Is.False); Assert.That(rollbackResult.Message, Is.EqualTo("rollback")); }