コード例 #1
0
 public override void Context()
 {
     _callStack                = mock <ICallStack>();
     _pendingSpecification     = mock <IPendingSpecification>();
     _callActions              = mock <ICallActions>();
     _callSpecificationFactory = mock <ICallSpecificationFactory>();
 }
コード例 #2
0
        public StepTaskEntityBase GetStepEntity(ICallStack stack)
        {
            // 当前当前StepRoot为null,则说明序列已经执行结束,返回null
            if (null == _stepEntityRoot)
            {
                return(null);
            }
            StepTaskEntityBase currentStep = _stepEntityRoot;
            int currentLevel = 0;
            int stepId       = stack.StepStack[currentLevel];

            for (int i = 0; i < stepId; i++)
            {
                currentStep = currentStep.NextStep;
            }
            currentLevel++;
            while (currentLevel < stack.StepStack.Count && null != currentStep.SubStepRoot)
            {
                currentStep = currentStep.SubStepRoot;
                stepId      = stack.StepStack[currentLevel];
                for (int i = 0; i < stepId; i++)
                {
                    currentStep = currentStep.NextStep;
                }
                currentLevel++;
            }
            return(currentStep);
        }
コード例 #3
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            bool result         = bool.Parse(ArgumentExpression.Calculate(MainExp));
            bool optionalResult = true;

            if (!string.IsNullOrEmpty(OptionalExp))
            {
                optionalResult = bool.Parse(ArgumentExpression.Calculate(OptionalExp));
            }

            bool resultingIf = callStack.ResultingIf;

            callStack.AddIfStack(result);
            if (!result && resultingIf && optionalResult)
            {
                nextIndex = callStack.CurrentCommandIndex + 1;
            }
            else
            {
                var currentScenario = context.ScenarioRepository.GetCurrentRunningScenario();
                for (int i = callStack.CurrentCommandIndex + 1; i < currentScenario.Commands.Count; i++)
                {
                    if (typeof(ILogicControlCommand).IsAssignableFrom(currentScenario.Commands[i].GetType()))
                    {
                        nextIndex = i;
                        break;
                    }
                }
            }
        }
コード例 #4
0
 public override void Context()
 {
     _callStack = mock <ICallStack>();
     _call      = mock <ICall>();
     _sequenceNumberGenerator = mock <SequenceNumberGenerator>();
     _sequenceNumberGenerator.stub(x => x.Next()).Return(42);
 }
コード例 #5
0
 public ExecutionEngine(CompiledModel compiledModel, IGCHeap gcHeap, ITypesHeap typesHeap, ITypeLoader typeLoader, ICallStack callStack, IILOperationSet ilOperationSet)
 {
     _compiledModel             = compiledModel;
     _callStack                 = callStack;
     _methodStateMachineFactory = new MethodStateMachineFactory(gcHeap, typesHeap, typeLoader, ilOperationSet);
     FillInterruptionResolvers();
 }
コード例 #6
0
        public SubroutineCommandFactory(ICallStack callStack)
        {
            if (callStack == null)
                throw new ArgumentNullException("callStack");

            _callStack = callStack;
        }
コード例 #7
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            string val = exp;

            val = context.VariableRepository.GetString(exp);
            context.MessagePresenter.RenderMessage(val);
        }
コード例 #8
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            Color maskColor = Color.black;

            ColorUtility.TryParseHtmlString(color, out maskColor);
            context.ScenePresenter.MaskOn(time, maskColor, wait);
        }
コード例 #9
0
ファイル: CoreUtils.cs プロジェクト: streamHe/Testflow-1
        public static string GetRuntimeVariableName(string variableName, ICallStack stack)
        {
            StringBuilder runtimeVarName = new StringBuilder(50);

            return(runtimeVarName.Append(stack.SessionIndex)
                   .Append(stack.Session).Append(VarNameDelim).Append(string.Join(VarNameDelim, stack.StepStack))
                   .Append(VarNameDelim).Append(variableName).ToString());
        }
コード例 #10
0
 public GetCallSpec(ICallStack callStack, IPendingSpecification pendingSpecification,
                    ICallSpecificationFactory callSpecificationFactory, ICallActions callActions)
 {
     _callStack                = callStack;
     _pendingSpecification     = pendingSpecification;
     _callSpecificationFactory = callSpecificationFactory;
     _callActions              = callActions;
 }
コード例 #11
0
 public GetCallSpec(ICallStack callStack, IPendingSpecification pendingSpecification,
     ICallSpecificationFactory callSpecificationFactory, ICallActions callActions)
 {
     _callStack = callStack;
     _pendingSpecification = pendingSpecification;
     _callSpecificationFactory = callSpecificationFactory;
     _callActions = callActions;
 }
コード例 #12
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            ArgumentExpression eo = new ArgumentExpression(exp);

            string result = ArgumentExpression.Calculate(eo.exp);

            context.VariableRepository.SetString(eo.name, result);
        }
コード例 #13
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            var prevCall = callStack.Pop();

            jumpIndex = prevCall.index;
            //throw new NotImplementedException();
            context.ScenarioRepository.JumpToScenario(prevCall.scenarioNname);
        }
コード例 #14
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     if (callStack.Count > 0)
     {
         var stackItem = callStack.Pop();
         context.ScenarioRepository.JumpToScenario(stackItem.scenarioNname);
         index = stackItem.index;
     }
 }
コード例 #15
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.VariableRepository.SetString(name, dname);
     context.ActorPresenter.RegisterNewActor(name, tag, asset);
     if (!string.IsNullOrEmpty(size))
     {
         context.ActorPresenter.SetSize(name, size);
     }
 }
コード例 #16
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            string show_name = val;

            context.ActorPresenter.SetFocus(val);
            show_name = ArgumentExpression.replaceVariable(val, context.VariableRepository);
            //show_name = context.VariableRepository.GetString(val);
            context.MessagePresenter.SetTokenName(show_name);
        }
コード例 #17
0
 public override void Context()
 {
     _callStack       = mock <ICallStack>();
     _callResults     = mock <ICallResults>();
     _routeArguments  = new object[] { 2 };
     _substituteState = mock <ISubstituteState>();
     _substituteState.stub(x => x.FindInstanceFor(typeof(ICallStack), _routeArguments)).Return(_callStack);
     _substituteState.stub(x => x.FindInstanceFor(typeof(ICallResults), _routeArguments)).Return(_callResults);
     _substituteState.stub(x => x.FindInstanceFor(typeof(int), _routeArguments)).Return(_routeArguments[0]);
 }
コード例 #18
0
 public ResultSetter(ICallStack callStack, IPendingSpecification pendingSpecification,
                     ICallResults configuredResults, ICallSpecificationFactory callSpecificationFactory,
                     ICallActions callActions)
 {
     _callStack                = callStack;
     _pendingSpecification     = pendingSpecification;
     _configuredResults        = configuredResults;
     _callSpecificationFactory = callSpecificationFactory;
     _callActions              = callActions;
 }
コード例 #19
0
        public CallSubroutineCommand(int address, int operationCode, ICallStack callStack)
            : base(address, operationCode)
        {
            if (FirstOperationCodeHalfByte != 0x2)
                throw new ArgumentOutOfRangeException("operationCode");
            if (callStack == null)
                throw new ArgumentNullException("callStack");

            _callStack = callStack;
        }
コード例 #20
0
            public override void Context()
            {
                _callStack                = mock <ICallStack>();
                _pendingSpecification     = mock <IPendingSpecification>();
                _configuredResults        = mock <ICallResults>();
                _callActions              = mock <ICallActions>();
                _callSpecificationFactory = mock <ICallSpecificationFactory>();

                _returnValue = mock <IReturn>();
            }
コード例 #21
0
ファイル: ResultSetter.cs プロジェクト: robdmoore/NSubstitute
 public ResultSetter(ICallStack callStack, IPendingSpecification pendingSpecification,
     ICallResults configuredResults, ICallSpecificationFactory callSpecificationFactory,
     ICallActions callActions)
 {
     _callStack = callStack;
     _pendingSpecification = pendingSpecification;
     _configuredResults = configuredResults;
     _callSpecificationFactory = callSpecificationFactory;
     _callActions = callActions;
 }
コード例 #22
0
        //to do: check valid steps
        public ISequenceStep GetSequenceStep(ICallStack stack)
        {
            ISequence     sequence = Context.SequenceGroup.Sequences[stack.Sequence];
            ISequenceStep step     = sequence.Steps[stack.StepStack[0]];

            for (int n = 1; n < stack.StepStack.Count; n++)
            {
                step = step.SubSteps[stack.StepStack[n]];
            }
            return(step);
        }
コード例 #23
0
        public ReturnFromSubroutineCommand(int address, int operationCode, ICallStack callStack)
            : base(address, operationCode)
        {
            if (operationCode != 0x00EE)
                throw new ArgumentOutOfRangeException("operationCode");
            if (callStack == null)
                throw new ArgumentNullException("callStack");

            _callStack = callStack;
            _initialTopOfStack = callStack.Peek();
        }
コード例 #24
0
ファイル: SequenceUtils.cs プロジェクト: spartajet/Testflow
        /// <summary>
        /// 通过Stack获取Step
        /// </summary>
        public static ISequenceStep GetStepFromStack(ISequenceGroup sequenceGroup, ICallStack callStack)
        {
            if (callStack.StepStack.Count <= 0)
            {
                return(null);
            }
            int       sessionId     = callStack.Session;
            int       sequenceIndex = callStack.Sequence;
            ISequence sequence      = GetSequence(sequenceGroup, sessionId, sequenceIndex);

            return(GetStepFromStack(sequence, callStack.StepStack, callStack.ToString()));
        }
コード例 #25
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     if (!string.IsNullOrEmpty(face))
     {
         context.ActorPresenter.SetActorFace(name, face);
     }
     if (!string.IsNullOrEmpty(size))
     {
         context.ActorPresenter.SetSize(name, size, time);
     }
     context.ActorPresenter.SetRegion(name, region);
     context.ActorPresenter.ShowActor(name, time, wait);
 }
コード例 #26
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            nextIndex = callStack.Push();
            var macro = context.ScenarioMacroRepository.GetMacro(name);

            if (macro != null)
            {
                nextIndex = macro.index;
                context.ScenarioRepository.JumpToScenario(macro.file_name);
            }
            else
            {
                nextIndex += 1;
            }
        }
コード例 #27
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            bool useExternalSource = string.IsNullOrEmpty(source);

            if (string.IsNullOrEmpty(name))
            {
                name = useExternalSource ? source : asset;
            }
            if (string.IsNullOrEmpty(tag))
            {
                tag = name;
            }

            context.ScenePresenter.RegisterImageFromAssetSource(name, tag, asset);
        }
コード例 #28
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            int      currentIndex    = callStack.CurrentCommandIndex;
            Scenario currentScenario = context.ScenarioRepository.GetCurrentRunningScenario();
            Macro    macro           = new Macro(name, currentScenario.name, currentIndex);

            context.ScenarioMacroRepository.RecordMacro(macro);
            for (int i = currentIndex; i < currentScenario.Commands.Count; i++)
            {
                ICommand command = currentScenario.Commands[i];
                if (command is EndmacroCommand)
                {
                    endIndex = i;
                }
            }
        }
コード例 #29
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            FontOverrideData fontOverrideData = FontOverrideData.Default;

            if (!string.IsNullOrEmpty(color))
            {
                fontOverrideData.ColorCode = color;
            }
            if (size > float.Epsilon)
            {
                fontOverrideData.Size = size;
            }
            fontOverrideData.Bold    = bold;
            fontOverrideData.Italics = italics;
            context.MessagePresenter.SetFont(fontOverrideData);
        }
コード例 #30
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            callStack.ClearIfStack();
            if (string.IsNullOrEmpty(file))
            {
                file = context.ScenarioRepository.GetCurrentRunningScenario().name;
            }
            file = ArgumentExpression.replaceVariable(file, context.VariableRepository);

            context.ScenarioRepository.JumpToScenario(file);

            target = ArgumentExpression.replaceVariable(target, context.VariableRepository);

            if (index < 0)
            {
                index = context.ScenarioRepository.GetScenario(file).getIndex(target);
            }
        }
コード例 #31
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            bool useExternalSource = string.IsNullOrEmpty(source);

            if (string.IsNullOrEmpty(name))
            {
                name = useExternalSource ? source : asset;
            }
            if (string.IsNullOrEmpty(tag))
            {
                tag = name;
            }
            if (useExternalSource)
            {
                context.ScenePresenter.RegisterBackgroundFromAssetSource(name, tag, asset);
            }
            else
            {
                context.ScenePresenter.RegisterBackgroundFromExternalSource(name, tag, source);
            }
            //context.ScenePresenter.ShowBackground(tag);
        }
コード例 #32
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     context.ActorPresenter.HideActor(name, time, wait);
 }
コード例 #33
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
 }
コード例 #34
0
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            string tagToUse = string.IsNullOrEmpty(tag) ? name : tag;

            context.ScenePresenter.ShowImage(tagToUse);
        }
コード例 #35
0
 private static CallSubroutineCommand CreateCallSubroutineCommand(int operationCode = 0x2001,
     ICallStack callStack = null)
 {
     return new CallSubroutineCommand(0, operationCode, callStack ?? Substitute.For<ICallStack>());
 }
コード例 #36
0
 public RecordCallHandler(ICallStack callStack)
 {
     _callStack = callStack;
 }
コード例 #37
0
 internal static SubroutineCommandFactory CreateSubroutineCommandFactory(ICallStack callStack = null)
 {
     return new SubroutineCommandFactory(callStack ?? Substitute.For<ICallStack>());
 }
コード例 #38
0
 public RecordCallHandler(ICallStack callStack, SequenceNumberGenerator generator)
 {
     _callStack = callStack;
     _generator = generator;
 }
コード例 #39
0
 public ResultSetter(ICallStack callStack, ICallResults configuredResults, ICallSpecificationFactory callSpecificationFactory)
 {
     _callStack = callStack;
     _configuredResults = configuredResults;
     _callSpecificationFactory = callSpecificationFactory;
 }
コード例 #40
0
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     throw new NotImplementedException();
 }
コード例 #41
0
 public CheckReceivedCallHandler(ICallStack callStack, ICallResults configuredResults, ICallSpecificationFactory callSpecificationFactory)
 {
     _callStack = callStack;
     _configuredResults = configuredResults;
     _callSpecificationFactory = callSpecificationFactory;
 }