コード例 #1
0
ファイル: WeaverPathPipe.cs プロジェクト: inthefabric/Weaver
        /*--------------------------------------------------------------------------------------------*/
        public static TBack Back <T, TBack>(this T pElem, IWeaverStepAs <TBack> pAlias)
            where T : IWeaverElement where TBack : IWeaverElement
        {
            var f = new WeaverStepBack <TBack>(pAlias);

            pElem.Path.AddItem(f);
            return(pAlias.Item);
        }
コード例 #2
0
        public void NotInPath(int pItemIndex)
        {
            var mockAlias = new Mock <IWeaverStepAs <Person> >();

            mockAlias.SetupGet(x => x.PathIndex).Returns(pItemIndex);

            WeaverTestUtil.CheckThrows <WeaverStepException>(true, () => {
                var f = new WeaverStepBack <Person>(mockAlias.Object);
            });
        }
コード例 #3
0
        public void BuildParameterizedString()
        {
            const int itemI = 99;

            var mockAlias = new Mock <IWeaverStepAs <Person> >();

            mockAlias.SetupGet(x => x.PathIndex).Returns(itemI);
            mockAlias.SetupGet(x => x.Label).Returns("step" + itemI);

            var f = new WeaverStepBack <Person>(mockAlias.Object);

            Assert.AreEqual("back('step" + itemI + "')", f.BuildParameterizedString(), "Incorrect result.");
        }
コード例 #4
0
        public void New()
        {
            const int itemI = 99;

            var mockAlias = new Mock <IWeaverStepAs <Person> >();

            mockAlias.SetupGet(x => x.PathIndex).Returns(itemI);
            mockAlias.SetupGet(x => x.Label).Returns("Test");

            var f = new WeaverStepBack <Person>(mockAlias.Object);

            Assert.AreEqual("Test", f.Label, "Incorrect Label.");
            Assert.AreEqual(mockAlias.Object, f.BackToItem, "Incorrect BackToItem.");
        }