Exemplo n.º 1
0
        public object Get(string actionUrlMode, string encType, string charset, string method, string InputText, string Select)
        {
            InputText = HttpUtility.UrlDecode(InputText);
            Select    = HttpUtility.UrlDecode(Select);
            string actionUrl  = null;
            object parameters = new { actionUrlMode = actionUrlMode, encType = encType, charset = charset, method = method };
            Uri    newUri     = BindingExtensions.BindTemplate(CommunicationContext.ApplicationBaseUri, new Template(Constants.FormSimplePath), parameters);

            if (actionUrlMode == "absolute")
            {
                actionUrl = newUri.AbsoluteUri;
            }
            else if (actionUrlMode == "relative")
            {
                actionUrl = newUri.AbsolutePath;
            }

            TestForm args = new TestForm();

            args.InputText = InputText;
            args.Select    = Select;
            args.ActionUrl = actionUrl;
            args.EncType   = (encType == "multipart" ? (string)MediaType.MultipartFormData : (string)MediaType.ApplicationFormUrlEncoded);
            args.Charset   = charset;
            args.Method    = method;

            return(args);
        }
Exemplo n.º 2
0
        public void ItSignalsMissingSessionWhenDecodingResponse()
        {
            // Example: for some odd reasons a web response is created outside of Ramone and we now try to decode it,
            // but without a session at hand.

            WebRequest request = WebRequest.Create(BindingExtensions.BindTemplate(BaseUrl, DossierTemplate, new { id = 8 }));

            using (WebResponse response = request.GetResponse())
            {
                Response ramoneResponse = new Response((HttpWebResponse)response, null, 0);
                AssertThrows <ArgumentNullException>(
                    () => ramoneResponse.Decode <ApplicationError>(),
                    ex => ex.Message.Contains("session"));
            }
        }