private T ShouldEvaluateToSuccessfulResult <T>(T constraint)
            where T : ISpecificationConstraint
        {
            if (this.constraint != null)
            {
                throw new InvalidOperationException("A constraint was already specified for the actual value.");
            }

            this.constraint = constraint;
            return(constraint);
        }
Esempio n. 2
0
        internal static void AddConstraint(ISpecificationConstraint constraint)
        {
            UserDataCollection data = Context.CurrentContext.Data;
            lock (data)
            {
                List<ISpecificationConstraint> constraints = data.GetValue<List<ISpecificationConstraint>>(ConstraintsKey);
                if (constraints == null)
                {
                    constraints = new List<ISpecificationConstraint>();
                    data.SetValue(ConstraintsKey, constraints);
                }

                constraints.Add(constraint);
            }
        }
Esempio n. 3
0
        internal static void AddConstraint(ISpecificationConstraint constraint)
        {
            UserDataCollection data = Context.CurrentContext.Data;

            lock (data)
            {
                List <ISpecificationConstraint> constraints = data.GetValue <List <ISpecificationConstraint> >(ConstraintsKey);
                if (constraints == null)
                {
                    constraints = new List <ISpecificationConstraint>();
                    data.SetValue(ConstraintsKey, constraints);
                }

                constraints.Add(constraint);
            }
        }