/*--------------------------------------------------------------------------------------------*/ 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); }
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); }); }
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."); }
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."); }