Exemple #1
0
        public void PostJsonGetJsonWithHttpRequestHelperWcfHelloWorld()
        {
            Uri    uri  = NormalizeUri("TestAjaxService.svc/HelloWorld");
            string json = HttpRequestHelper.AjaxTxt(uri, null, null);

            Assert.AreEqual("{\"d\":\"Hello World\"}", json);
        }
Exemple #2
0
        public void PostJsonGetJsonWithHttpRequestHelperWcfHelloWorldWithArgsInOut()
        {
            Uri uri = NormalizeUri("TestAjaxService.svc/HelloWorldWithArgsInOut");
            Dictionary <string, object> postData = new Dictionary <string, object>();

            // if you have a reference to the type expected you can serialize an instance
            // or just simply create an anonymous type that is shaped like the type expected...
            postData.Add("args", new { Message = "HI!" });

            string json = HttpRequestHelper.AjaxTxt(uri, postData, null);

            Assert.AreEqual("{\"d\":{\"__type\":\"HelloWorldArgs:#CassiniDev.FixtureExamples.TestWeb\",\"Message\":\"you said: HI!\"}}", json);
        }