1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#if !MOBILE && !XAMMAC_4_5
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Proxy.MonoTests.Features.Client;
using MonoTests.Features.Contracts;
using System.Threading;
namespace MonoTests.Features.Serialization
{
[TestFixture]
public class AsyncCallTest : TestFixtureBase<AsyncCallTesterContractClient, AsyncCallTester, MonoTests.Features.Contracts.IAsyncCallTesterContract>
{
bool client_QueryCompleted;
string s = string.Empty;
AutoResetEvent ev;
Exception err = null;
public AsyncCallTest()
{
}
[Test]
[Category ("NotWorking")]
public void TestAsyncCall ()
{
ev = new AutoResetEvent(false);
client_QueryCompleted = false;
ClientProxy.QueryCompleted += new EventHandler<QueryCompletedEventArgs>(Client_QueryCompleted);
ClientProxy.QueryAsync ("heh");
ev.WaitOne(2000, true);
Assert.IsTrue(client_QueryCompleted, "async call completed");
Assert.AreEqual("hehheh", s, "#1");
if (err != null) throw err;
}
private void Client_QueryCompleted (object sender, QueryCompletedEventArgs e)
{
client_QueryCompleted = true;
try
{
s = e.Result;
}
catch (Exception _e)
{
err = _e;
}
ev.Set();
}
}
}
#endif
|