示例#1
0
        /*--------------------------------------------------------------------------------------------*/
        public static FabTravStep ToFabTravStep(ITravRule pRule)
        {
            var s = new FabTravStep();

            s.Name   = pRule.Step.Command;
            s.Uri    = "/" + pRule.Step.Command;
            s.Return = (pRule.ToType == null ? null : pRule.ToType.Name);
            return(s);
        }
示例#2
0
        public void ToFabTravStep(Type pToType, string pExpectReturn)
        {
            const string cmd = "MyCommand";

            var mockStep = new Mock <ITravStep>(MockBehavior.Strict);

            mockStep.SetupGet(x => x.Command).Returns(cmd);

            var mockRule = new Mock <ITravRule>(MockBehavior.Strict);

            mockRule.SetupGet(x => x.Step).Returns(mockStep.Object);
            mockRule.SetupGet(x => x.ToType).Returns(pToType);

            FabTravStep result = TravRule.ToFabTravStep(mockRule.Object);

            Assert.NotNull(result, "Result should be filled.");
            Assert.AreEqual(cmd, result.Name, "Incorrect Name.");
            Assert.AreEqual("/" + cmd, result.Uri, "Incorrect Uri.");
            Assert.AreEqual(pExpectReturn, result.Return, "Incorrect Return.");
        }