Пример #1
0
        public IConsent IsValid(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter proposedValue)
        {
            if (proposedValue != null && !proposedValue.Spec.IsOfType(Spec))
            {
                string msg = string.Format(Resources.NakedObjects.TypeMismatchError, Spec.SingularName);
                return(GetConsent(msg));
            }

            var buf = new InteractionBuffer();
            IInteractionContext ic = InteractionContext.ModifyingPropParam(session, false, parentAction.RealTarget(nakedObjectAdapter), Identifier, proposedValue);

            InteractionUtils.IsValid(this, ic, buf);
            return(InteractionUtils.IsValid(buf));
        }
        private ITestNaked DoInvoke(int page, params object[] parameters)
        {
            ResetLastMessage();
            AssertIsValidWithParms(parameters);
            INakedObjectAdapter[] parameterObjectsAdapter = parameters.AsTestNakedArray(manager).Select(x => x.NakedObject).ToArray();

            INakedObjectAdapter[] parms = actionSpec.RealParameters(owningObject.NakedObject, parameterObjectsAdapter);
            INakedObjectAdapter target = actionSpec.RealTarget(owningObject.NakedObject);
            INakedObjectAdapter result = actionSpec.GetFacet<IActionInvocationFacet>().Invoke(target, parms, page, lifecycleManager, metamodelManager, session, manager, messageBroker, transactionManager);

            if (result == null) {
                return null;
            }
            if (result.Spec.IsCollection) {
                return factory.CreateTestCollection(result);
            }
            return factory.CreateTestObject(result);
        }
        private ITestNaked DoInvoke(int page, params object[] parameters)
        {
            ResetLastMessage();
            AssertIsValidWithParms(parameters);
            var parameterObjectsAdapter = parameters.AsTestNakedArray(framework.NakedObjectManager).Select(x => x.NakedObject).ToArray();

            var parms  = actionSpec.RealParameters(owningObject.NakedObject, parameterObjectsAdapter);
            var target = actionSpec.RealTarget(owningObject.NakedObject);
            var result = actionSpec.GetFacet <IActionInvocationFacet>().Invoke(target, parms, page, framework);

            if (result == null)
            {
                return(null);
            }

            if (result.Spec.IsCollection)
            {
                return(factory.CreateTestCollection(result));
            }

            return(factory.CreateTestObject(result));
        }