Exemplo n.º 1
0
        protected override ConstraintResult matches(object current)
        {
            Delegate = Must.Have.Property(nameof(Allocation.IsComplete), Is.False) &
                       Must.Have.Property(nameof(Allocation.IsQuasiComplete), Is.False) &
                       Must.Have.Property(nameof(Allocation.TotalAllocated), Is.EqualTo(Allocated)) &
                       Must.Have.Property(nameof(Allocation.Remainder), Is.EqualTo(Remainder));

            return(Delegate.ApplyTo(current));
        }
        protected override ConstraintResult matches(object current)
        {
            Delegate = Must.Satisfy.Conjunction(
                Must.Have.Property(nameof(Allocation.IsComplete), Is.True),
                Must.Have.Property(nameof(Allocation.IsQuasiComplete), Is.False),
                Must.Have.Property(nameof(Allocation.TotalAllocated), Is.EqualTo(Allocated)),
                Must.Have.Property(nameof(Allocation.Remainder), Is.EqualTo(Money.Zero(Allocated.CurrencyCode))));

            return(Delegate.ApplyTo(current));
        }
Exemplo n.º 3
0
            protected override ConstraintResult matches(object current)
            {
                string actual = (string)current;
                // check length first
                var result = Delegate.ApplyTo(actual);

                if (result.IsSuccess)
                {
                    // if long enough, check uppercase of first character
                    Delegate = new UppercaseConstraint();
                    result   = Delegate.ApplyTo(actual[0]);
                }
                return(result);
            }
Exemplo n.º 4
0
        protected override ConstraintResult matches(object current)
        {
            ConstraintResult result = new ConstraintResult(this, current, true);

            ISpecification <T> spec = (ISpecification <T>)current;

            foreach (var value in _values)
            {
                result = new SpecificationResult(Delegate, Delegate.ApplyTo(spec.IsSatisfiedBy(value)));
                if (!result.IsSuccess)
                {
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 5
0
        protected override ConstraintResult matches(object current)
        {
            uint counter = 0;
            EventHandler <ObsoleteCurrencyEventArgs> callback = (sender, e) => { counter++; };

            Currency.ObsoleteCurrency += callback;

            try
            {
                ((Action)current)();
            }
            finally
            {
                Currency.ObsoleteCurrency -= callback;
            }
            return(Delegate.ApplyTo(counter));
        }
Exemplo n.º 6
0
 protected override ConstraintResult matches(object current)
 {
     return(Delegate.ApplyTo(current));
 }
Exemplo n.º 7
0
 protected override ConstraintResult matches(object current)
 {
     Delegate = Must.Satisfy.Conjunction(_constraints.ToArray());
     return(Delegate.ApplyTo(current));
 }