Esempio n. 1
0
        public void GetFabTravSteps(Type pType, int pExpectCount)
        {
            IList <FabTravStep> result = TraversalUtil.GetFabTravSteps(pType);

            Assert.NotNull(result, "Result should be filled.");
            Assert.AreEqual(pExpectCount, result.Count, "Incorrect result count.");

            for (int i = 0; i < result.Count; i++)
            {
                Assert.NotNull(result[i], "Result[" + i + "] should be filled.");
            }
        }
Esempio n. 2
0
        public void GetAllTravRules()
        {
            IList <ITravRule> result = TraversalUtil.GetTravRules();

            Assert.NotNull(result, "Result should be filled.");
            Assert.AreEqual(TotalRuleCount, result.Count, "Incorrect result count.");

            for (int i = 0; i < result.Count; i++)
            {
                Assert.NotNull(result[i], "Result[" + i + "] should be filled.");
            }
        }
Esempio n. 3
0
        /*--------------------------------------------------------------------------------------------*/
        private ITravRule FindRuleForStep(ITravPathItem pStep)
        {
            IList <ITravRule> rules = TraversalUtil.GetTravRules(vPathData.CurrType);

            foreach (ITravRule r in rules)
            {
                if (r.Step.AcceptsPath(vPath))
                {
                    return(r);
                }
            }

            throw pStep.NewStepFault(FabFault.Code.InvalidStep,
                                     "Step '" + pStep.Command + "' is not valid.");
        }
Esempio n. 4
0
        /*--------------------------------------------------------------------------------------------*/
        private static FabSpecService BuildTraversalService(FabService pSvc,
                                                            Func <string, ApiEntry> pGetEntry)
        {
            IList <ITravRule> rules = TraversalUtil.GetTravRules();
            var map = new Dictionary <SpecStepAttribute, IList <ITravRule> >();

            foreach (ITravRule rule in rules)
            {
                SpecStepAttribute ssa = GetAttribute <SpecStepAttribute>(rule.Step.GetType());

                if (!map.ContainsKey(ssa))
                {
                    map.Add(ssa, new List <ITravRule>());
                }

                map[ssa].Add(rule);
            }

            ////

            FabSpecService svc = BuildService(pSvc, pGetEntry);

            svc.Steps = new List <FabSpecServiceStep>();

            foreach (SpecStepAttribute ssa in map.Keys)
            {
                if (ssa.IsRoot)
                {
                    continue;
                }

                svc.Steps.Add(BuildTraversalServiceStep(ssa, map[ssa]));
            }

            return(svc);
        }
Esempio n. 5
0
 /*--------------------------------------------------------------------------------------------*/
 public IList <FabTravStep> GetResultSteps()
 {
     return(TraversalUtil.GetFabTravSteps(vPathData.CurrType));
 }