Ejemplo n.º 1
0
        /// <summary>
        ///     Checks declarative constraints, and then checks imperatively.
        /// </summary>
        public IConsent IsParameterSetValid(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter[] parameterSet)
        {
            IInteractionContext ic;
            var buf = new InteractionBuffer();

            if (parameterSet != null)
            {
                INakedObjectAdapter[] parms = RealParameters(nakedObjectAdapter, parameterSet);
                for (int i = 0; i < parms.Length; i++)
                {
                    ic = InteractionContext.ModifyingPropParam(Session, false, RealTarget(nakedObjectAdapter), Identifier, parameterSet[i]);
                    InteractionUtils.IsValid(GetParameter(i), ic, buf);
                }
            }
            INakedObjectAdapter target = RealTarget(nakedObjectAdapter);

            ic = InteractionContext.InvokingAction(Session, false, target, Identifier, parameterSet);
            InteractionUtils.IsValid(this, ic, buf);
            return(InteractionUtils.IsValid(buf));
        }
Ejemplo n.º 2
0
        public override IConsent IsUsable(INakedObjectAdapter target)
        {
            IInteractionContext ic = InteractionContext.InvokingAction(Session, false, RealTarget(target), Identifier, new[] { target });

            return(InteractionUtils.IsUsable(this, ic));
        }
Ejemplo n.º 3
0
        public void IsNotProgramaticTest()
        {
            IInteractionContext context = InteractionContext.InvokingAction(null, null, false, null, null, null);

            Assert.IsFalse(context.IsProgrammatic);
        }
Ejemplo n.º 4
0
        public void IsProgramaticTest()
        {
            IInteractionContext context = InteractionContext.InvokingAction(null, null, true, null, null, null);

            Assert.IsTrue(context.IsProgrammatic);
        }