public void WebServerController_ExecuteGetRootLevelApisJson()
        {
            //------------Setup for test--------------------------
            var controller = new TestWebServerController(HttpMethod.Get);
            //------------Bookmark Test---------------------------
            var result = controller.ExecuteGetRootLevelApisJson();

            //------------Assert Results-------------------------
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(HttpResponseMessage));
        }
        public void WebServerController_Execute_InvokesWebPostRequestHandler()
        {
            //------------Setup for test--------------------------
            var requestVariables = new NameValueCollection
            {
                { "servicename", "HelloWorld" }
            };
            var controller = new TestWebServerController(HttpMethod.Post);

            //------------Execute Test---------------------------
            controller.ExecuteService("HelloWorld.apis.json");

            //------------Assert Results-------------------------
            Assert.AreEqual(typeof(GetApisJsonServiceHandler), controller.ProcessRequestHandlerType);
        }
        public void WebServerController_CreateHandler_IsNotNull()
        {
            //------------Setup for test--------------------------
            var user = new Mock <IPrincipal>();

            user.Setup(u => u.Identity.IsAuthenticated).Returns(true);

            var controller = new TestWebServerController(HttpMethod.Get);

            //------------Bookmark Test---------------------------
            var result = controller.TestCreateHandler <WebsiteResourceHandler>();

            //------------Assert Results-------------------------
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(WebsiteResourceHandler));
        }
        public void WebServerController_Execute_Get_InvokesWebPostRequestHandler()
        {
            //------------Setup for test--------------------------
            var requestVariables = new NameValueCollection
            {
                { "servicename", "HelloWorld" }
            };
            var controller = new TestWebServerController(HttpMethod.Get);

            //------------Execute Test---------------------------
            controller.ExecuteSecureWorkflow("HelloWorld");

            //------------Assert Results-------------------------
            Assert.AreEqual(typeof(WebGetRequestHandler), controller.ProcessRequestHandlerType);
            CollectionAssert.AreEqual(requestVariables, controller.ProcessRequestVariables);
        }
        public void WebServerController_Get_WebsitePathFolderStarFile_InvokesWebsiteResourceHandler()
        {
            //------------Setup for test--------------------------
            var requestVariables = new NameValueCollection
            {
                { "website", WebSite },
                { "path", "services" }
            };
            var controller = new TestWebServerController(HttpMethod.Get);

            //------------Execute Test---------------------------
            controller.Get(WebSite, "services", "Scripts", "fx/jquery.caret.js");

            //------------Assert Results-------------------------
            Assert.AreEqual(typeof(WebsiteResourceHandler), controller.ProcessRequestHandlerType);
            CollectionAssert.AreEqual(requestVariables, controller.ProcessRequestVariables);
        }
        public void WebServerController_Get_WebsiteFolderFile_InvokesWebsiteResourceHandler()
        {
            //------------Setup for test--------------------------
            var requestVariables = new NameValueCollection
            {
                { "website", WebSite },
                { "path", "dialogs/SaveDialog.htm" }
            };
            var controller = new TestWebServerController(HttpMethod.Get);

            //------------Execute Test---------------------------
            controller.Get(WebSite, "dialogs", "SaveDialog.htm");

            //------------Assert Results-------------------------
            Assert.AreEqual(typeof(WebsiteResourceHandler), controller.ProcessRequestHandlerType);
            CollectionAssert.AreEqual(requestVariables, controller.ProcessRequestVariables);
        }
        public void WebServerController_InvokeService_WebsitePathNameMethod_InvokesWebsiteServiceHandler()
        {
            //------------Setup for test--------------------------
            var requestVariables = new NameValueCollection
            {
                { "website", WebSite },
                { "path", "Service" },
                { "name", "Resources" },
                { "action", "PathsAndNames" },
            };
            var controller = new TestWebServerController(HttpMethod.Post);

            //------------Execute Test---------------------------
            controller.InvokeService(WebSite, "Service", "Resources", "PathsAndNames");

            //------------Assert Results-------------------------
            Assert.AreEqual(typeof(WebsiteServiceHandler), controller.ProcessRequestHandlerType);
            CollectionAssert.AreEqual(requestVariables, controller.ProcessRequestVariables);
        }
        public void WebServerControllerPublic_ExecuteGivenNullUri_InvokesWebPostRequestHandler()
        {
            //------------Setup for test--------------------------
            const string requestUrl       = "http://rsaklfnkosinath:3142/Public/Hello%20World/.tests";
            var          requestVariables = new NameValueCollection
            {
                { "path", requestUrl },
                { "isPublic", true.ToString() },
                { "servicename", "*" },
            };

            var controller = new TestWebServerController(HttpMethod.Get, requestUrl);

            //------------Execute Test---------------------------
            controller.Request.RequestUri = null;
            controller.ExecutePublicWorkflow("HelloWorld");

            //------------Assert Results-------------------------
            Assert.AreEqual(typeof(WebGetRequestHandler), controller.ProcessRequestHandlerType);
        }
        public void WebServerController_ExecuteDotDebug_Post_InvokesWebPostRequestHandler()
        {
            //------------Setup for test--------------------------
            const string requestUrl       = "http://http://rsaklfnkosinath:3142/secure/Hello%20World.debug?Name=&wid=7af4273a-4e31-4559-be7d-eecfb4c1b10e";
            var          requestVariables = new NameValueCollection
            {
                { "isPublic", true.ToString() },
                { "IsDebug", true.ToString() },
                { "servicename", "HelloWorld.debug" }
            };

            var controller = new TestWebServerController(HttpMethod.Post, requestUrl);

            //------------Execute Test---------------------------
            controller.ExecuteSecureWorkflow("HelloWorld.debug");

            //------------Assert Results-------------------------
            Assert.AreEqual(typeof(WebPostRequestHandler), controller.ProcessRequestHandlerType);
            CollectionAssert.AreEqual(requestVariables, controller.ProcessRequestVariables);
        }
Esempio n. 10
0
        static void Verify_WebsiteGetFile(WebServerRequestType requestType, string url)
        {
            //------------Setup for test--------------------------
            var requestVariables = new NameValueCollection
            {
                { "website", WebSite },
                { "path", url }
            };

            var controller = new TestWebServerController(HttpMethod.Get);

            //------------Execute Test---------------------------
            switch (requestType)
            {
            case WebServerRequestType.WebGetContent:
                controller.GetContent(WebSite, url);
                break;

            case WebServerRequestType.WebGetImage:
                controller.GetImage(WebSite, url);
                break;

            case WebServerRequestType.WebGetScript:
                controller.GetScript(WebSite, url);
                break;

            case WebServerRequestType.WebGetView:
                controller.GetView(WebSite, url);
                break;

            default:
                throw new ArgumentOutOfRangeException("requestType");
            }

            //------------Assert Results-------------------------
            Assert.AreEqual(typeof(WebsiteResourceHandler), controller.ProcessRequestHandlerType);
            CollectionAssert.AreEqual(requestVariables, controller.ProcessRequestVariables);
        }