Ejemplo n.º 1
0
        public void TestHttpAsmx()
        {
            foreach (var s in _serviceManager.AllServers)
            {
                Debug.WriteLine(s.Port);
                using (var ws = new TestService())
                //using (var wait = new ManualResetEvent(false))
                {
                    var proto = s.UseHttps ? "https" : "http";
                    ws.Url = proto + "://127.0.0.1:" + s.Port + "/TestService.asmx";

                    var result = ws.SimpleMethod();
                    Assert.IsTrue(result.Contains("Hello World"));

                    //ws.SimpleMethodCompleted += (sender, args) =>
                    //{
                    //    Assert.IsNull(args.Error);
                    //    Assert.IsFalse(args.Cancelled);
                    //    Assert.IsNotNull(args.Result);
                    //    Assert.IsTrue(args.Result.Contains("Hello World"));

                    //    var w = (ManualResetEvent)args.UserState;
                    //    w.Set();
                    //};

                    //ws.SimpleMethodAsync(wait);

                    //if (!wait.WaitOne(Debugger.IsAttached ? -1 : 5000))
                    //{
                    //    Assert.Fail("No response was received after 5 seconds.");
                    //}

                }
            }
        }
Ejemplo n.º 2
0
        public void TestSingleHttpAsmx()
        {
            var s = _serviceManager.AllServers[0];

            using (var ws = new TestService())
            {
                var proto = s.UseHttps ? "https" : "http";
                ws.Url = proto + "://127.0.0.1:" + s.Port + "/TestService.asmx";
                //ws.UserAgent = "Java1.4.2_10";

                var result = ws.SimpleMethod();
                Assert.IsTrue(result.Contains("Hello World"));
            }
        }