Exemplo n.º 1
0
    static void Main()
    {
        Task t = TestAsync.DoWorkAsync();

        t.Wait();
        Console.WriteLine("Press Enter key to exit");
        Console.Read();
    }
Exemplo n.º 2
0
 // 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;
 }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 private TimingComponentConfiguration WithAsync()
 {
     return(new TimingComponentConfiguration
     {
         ServiceName = "Rick's Service",
         IntervalInMillseconds = 2000,
         Perform = async() =>
         {
             Console.WriteLine("Fired");
             var t = new TestAsync();
             await t.RunAsync();
         }
     });
 }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            // 简单测试.
            TestAsync.SimpleInvokeTest();

            // 等待任意一个执行完毕的测试.
            TestAsync.WaitAnyTest();

            // 异步处理后, 周期检查异步处理执行结果.
            TestAsync.IsCompletedTest();

            // 异步处理时,通过指定 回调函数进行处理.
            TestAsync.CallbackTest();


            Console.ReadLine();
        }
Exemplo n.º 7
0
 /// <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
     });
 }
Exemplo n.º 8
0
 public object Any(TestAsync request)
 {
     return new TestAsyncResponse { Foo = this.foo, ExecuteTimes = ++ExecuteTimes };
 }
Exemplo n.º 9
0
    static void Main(string[] args)
    {
        TestAsync async = new TestAsync();

        async.Go().Wait();
    }