コード例 #1
0
        public void ExternalRenderControlsGetControl()
        {
            RootElementMaster target = new RootElementMaster(TEST_FACTORY_KEY);

            OsGet ctl = new OsGet();

            ctl.LoadTag("<os:Get src='http://www.lolcats.com' resolver='server' />");

            target.Controls.Add(ctl);
            target.RegisterExternalServerRenderControl(ctl);

            List <IExternalDataSource> sources = target.GetExternalServerRenderControls();

            Assert.IsNotNull(sources);
            Assert.Greater(sources.Count, 0, "No sources defined");
            Assert.AreEqual(sources[0], ctl, "Not a matching control");
        }
コード例 #2
0
        public void ScopedExternalRenderControlsFiltered(string registeredView, string scopedView, bool expectedFound)
        {
            RootElementMaster target = new RootElementMaster(TEST_FACTORY_KEY);

            target.RegisterViews(registeredView);
            OsGet ctl = new OsGet();

            ctl.LoadTag("<os:Get src='http://www.lolcats.com' resolver='server' />");

            target.Controls.Add(ctl);
            target.RegisterExternalServerRenderControl(ctl, target.GetViewMask(registeredView));

            List <IExternalDataSource> sources = target.GetExternalServerRenderControls(scopedView);

            Assert.IsNotNull(sources);
            Assert.AreEqual(expectedFound, sources.Count > 0, "Sources not filtered");
        }
コード例 #3
0
        public void ExternalRenderControlsFindControl()
        {
            RootElementMaster target = new RootElementMaster(TEST_FACTORY_KEY);

            OsGet ctl = new OsGet();

            ctl.LoadTag("<os:Get src='http://www.lolcats.com' resolver='server' />");

            Assert.IsFalse(string.IsNullOrEmpty(ctl.SourceUri), "Empty src");
            Assert.IsTrue(ctl.ResolveLocation == ResolveAt.Server, "Not marked for server resolution");

            Assert.IsFalse(target.HasExternalServerRenderControls());
            target.Controls.Add(ctl);
            target.RegisterExternalServerRenderControl(ctl);

            Assert.IsTrue(target.HasExternalServerRenderControls(), "Control not registered as External Ref");
        }