Example #1
0
        public void TestHttpAsmxWse()
        {
            foreach (var s in _serviceManager.AllServers)
            {
                Console.WriteLine(s.Port);
                using (var ws = new TestServiceWse())
                //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.");
                    //}
                }
            }
        }
Example #2
0
        public void TestHttpAsmxWse()
        {
            foreach (var s in _serviceManager.AllServers)
            {
                Console.WriteLine(s.Port);
                using (var ws = new TestServiceWse())
                //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.");
                    //}
                }
            }
        }