public void BeginCreateService1(SampleItem instance, ReliableAsyncCallback callback, object state) { BeginRequest(RequestMethod.POST, _target, "Service1/", null, new Dictionary<string, object> { { "instance", instance } }, ContentType.JSON, ContentType.JSON, TimeSpan.Zero, 3000, 0, callback, state); }
public void TestServerCreate() { var gate = new AutoResetEvent(false); Exception exception = null; SampleItem item = new SampleItem(){StringValue = "foo"}; SampleItem result = null; var client = new SampleClient(RootUrl.TrimEnd('/')) { Serializer = new Serializer() }; client.BeginCreateService1(item ,ar => { try { result = client.EndCreateService1(ar); } catch (Exception ex) { exception = ex; } gate.Set(); }, null); if (!gate.WaitOne(60000)) { throw new Exception("timed out"); } if (exception != null) { throw exception; } Assert.AreEqual(1, result.Id); }