コード例 #1
0
        public void GetUrl_Control_ReturnsNull()
        {
            var resolver = new DesignerResolver();
            var url      = resolver.GetUrl(typeof(DummyControl));

            Assert.IsNull(url, "The default designer URL for WebForms widget should be null.");
        }
コード例 #2
0
        public void GetUrl_MvcCustomDesignerController_ReturnsCustomDesignerUrl()
        {
            var resolver = new DesignerResolver();
            var url      = resolver.GetUrl(typeof(DummyCustomDesignerController));

            Assert.AreEqual(DummyCustomDesignerController.CustomDesignerUrl, url, "The designer URL specified in the controller's attribute is not retrieved properly.");
        }
コード例 #3
0
        public void GetUrl_MvcController_ReturnsDefaultMvcDesignerUrl()
        {
            var resolver = new DesignerResolver();
            var url      = resolver.GetUrl(typeof(DummyController));

            Assert.AreEqual("~/Telerik.Sitefinity.Frontend/Designer/GetDesigner/Dummy", url, "The default designer URL is not retrieved properly.");
        }
コード例 #4
0
        public void GetUrl_ControlWithMvcDesigner_ReturnsMvcDesignerUrl()
        {
            var resolver = new DesignerResolver();
            var url      = resolver.GetUrl(typeof(DummyMvcDesignerControl));

            Assert.AreEqual(DummyMvcDesignerControl.CustomDesignerUrl, url,
                            "The specified designer URL should be returned for WebForms widget when DesignerUrl attribute is set.");
        }
コード例 #5
0
        public void GetUrl_MvcEmptyDesignerUrl_ReturnsOldDesignerUrl()
        {
            // Arrange
            var resolver = new DesignerResolver();

            // Act
            var url = resolver.GetUrl(typeof(DummyOldDesignerController));

            // Assert
            Assert.IsTrue(url.IsNullOrEmpty(), "The old designer URL is not retrieved properly.");
        }
コード例 #6
0
        public void GetUrl_ControllerWithPackage_ReturnsMvcDesignerUrlWithPackageQuery()
        {
            // Arrange
            var resolver = new DesignerResolver();
            var context  =
                new HttpContextWrapper(
                    new HttpContext(
                        new HttpRequest(null, "http://tempuri.org/test?package=MyPackage", "package=MyPackage"),
                        new HttpResponse(null)));

            // Act
            string url = null;

            SystemManager.RunWithHttpContext(context, () => { url = resolver.GetUrl(typeof(DummyController)); });

            // Assert
            Assert.AreEqual("~/Telerik.Sitefinity.Frontend/Designer/Master/Dummy?package=MyPackage", url, "The default designer URL is not retrieved properly.");
        }
コード例 #7
0
 public void GetUrl_WithoutWidgetType_ThrowsException()
 {
     var resolver = new DesignerResolver();
     var url      = resolver.GetUrl(null);
 }