static void Main() { Task t = TestAsync.DoWorkAsync(); t.Wait(); Console.WriteLine("Press Enter key to exit"); Console.Read(); }
// Start is called before the first frame update async UniTask Start() { var async = new TestAsync(); BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; var a = async.GetType().GetMethod("A", flags); var atask = (UniTask)a.Invoke(async, null); await atask; var b = async.GetType().GetMethod("B", flags); var btask = (UniTask)b.Invoke(async, null); await btask; }
public void Call_AsyncOneWay_endpoint_on_AsyncTestService_calls_ExecuteAsync() { var host = new TestAppHost(); host.Init(); TestAsyncService.ResetStats(); var request = new TestAsync(); var response = host.ExecuteService(request, EndpointAttributes.OneWay) as TestAsyncResponse; Assert.That(response, Is.Not.Null); Assert.That(response.ExecuteTimes, Is.EqualTo(0)); Assert.That(response.ExecuteAsyncTimes, Is.EqualTo(1)); }
private TimingComponentConfiguration WithAsync() { return(new TimingComponentConfiguration { ServiceName = "Rick's Service", IntervalInMillseconds = 2000, Perform = async() => { Console.WriteLine("Fired"); var t = new TestAsync(); await t.RunAsync(); } }); }
static void Main(string[] args) { // 简单测试. TestAsync.SimpleInvokeTest(); // 等待任意一个执行完毕的测试. TestAsync.WaitAnyTest(); // 异步处理后, 周期检查异步处理执行结果. TestAsync.IsCompletedTest(); // 异步处理时,通过指定 回调函数进行处理. TestAsync.CallbackTest(); Console.ReadLine(); }
/// <summary>Anies the given request.</summary> /// /// <param name="request">The request.</param> /// /// <returns>A TestAsyncResponse.</returns> public TestAsyncResponse Any(TestAsync request) { return(new TestAsyncResponse { Foo = this.foo, ExecuteTimes = ++ExecuteTimes }); }
public object Any(TestAsync request) { return new TestAsyncResponse { Foo = this.foo, ExecuteTimes = ++ExecuteTimes }; }
static void Main(string[] args) { TestAsync async = new TestAsync(); async.Go().Wait(); }