示例#1
0
 public static OperationResult AsDone(AppliedOperation appliedOperation, string comment = null)
 {
     return(new OperationResult
     {
         Status = OperationStatus.Done,
         Result = appliedOperation,
         Comment = comment
     });
 }
示例#2
0
 bool IEquatable <OperationResult> .Equals(OperationResult other)
 {
     if (other == null)
     {
         return(false);
     }
     return(this.Status.Equals(other.Status) &&
            string.Equals(this.Comment, other.Comment) &&
            AppliedOperation.Equals(this.Result, other.Result));
 }
示例#3
0
        public OperationResult ApplyOn(Account account)
        {
            if (!IsValidFor(account))
            {
                return(OperationResult.AsRejected("rejected"));
            }

            var appliedOperation = new AppliedOperation(
                this,
                account.CurrentBalance,
                account.CurrentBalance - Amount,
                DateTime.Now
                );

            return(OperationResult.AsDone(appliedOperation));
        }