コード例 #1
0
        public void TestMultiViewDataKeys()
        {
            GadgetMaster target;
            DataGadgetViewScopedTestData gadget = new DataGadgetViewScopedTestData();

            target = new GadgetMaster(testFactory, gadget.Source);

            ResolveDataControlValues(target.MyDataContext, gadget.ExpectedViewer, gadget.ExpectedViewer, gadget.ExpectedFriends);

            //vwr, myfriends

            DataContext dc = target.MasterDataContext;

            Assert.IsTrue(dc.HasVariable(gadget.GlobalDataItemKey), "global data key not defined");
            DataItem di;

            di = dc.MasterData[gadget.GlobalDataItemKey];
            Assert.IsTrue(di.IsValidForView("profile"), "incorrectly invalid on profile");
            Assert.IsTrue(di.IsValidForView("canvas"), "incorrectly invalid on canvas");
        }
コード例 #2
0
        public void TestDataKeyViews()
        {
            GadgetMaster target;
            DataGadgetViewScopedTestData gadget = new DataGadgetViewScopedTestData();

            target = new GadgetMaster(testFactory, gadget.Source);

            ResolveDataControlValues(target.MyDataContext, gadget.ExpectedViewer, gadget.ExpectedViewer, gadget.ExpectedFriends);

            //vwr, myfriends

            DataContext dc = target.MasterDataContext;

            Assert.IsTrue(dc.HasVariable("vwr"), "vwr key not defined");
            Assert.IsTrue(dc.HasVariable("myfriends"), "myfriends key not defined");

            Assert.IsFalse(dc.HasVariable("foo"), "Bad variable foo appears registered");

            DataItem di;

            di = dc.MasterData["vwr"];
            Assert.IsFalse(di.IsValidForView("profile"), "incorrectly valid on profile");
            Assert.IsTrue(di.IsValidForView("canvas"), "incorrectly invalid on canvas");
        }