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); }
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); } }
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); } }