Пример #1
0
        public void ShouldBeAbleToUseGenericInvokeAsync()
        {
            AsyncProxyableEcho testObj = GetTestAsyncProxyable();

            AutoResetEvent blocker = new AutoResetEvent(false);
            string         value   = "this is a value: ".RandomString(8);
            Task <string>  task    = testObj.InvokeAsync <string>("Send", value);

            task.Wait(1000 * 60 * 3);

            StopServers();
            Expect.AreEqual(value, task.Result);
        }
Пример #2
0
        public void ShouldUseCacheInvokeAsync()
        {
            AsyncProxyableEcho testObj = GetTestAsyncProxyable();

            AutoResetEvent blocker = new AutoResetEvent(false);
            string         value   = "this is a value";
            Task <string>  task    = testObj.InvokeAsync <string>("Send", value);

            task.Wait(1000 * 60 * 3);

            StopServers();
            Expect.AreEqual(value, task.Result);
            // TODO: add better assertions that validate that the remote call wasn't made and the result was retrieved from the local repo
        }
Пример #3
0
        public void ShouldBeAbleToUseInvokeAsync()
        {
            AsyncProxyableEcho testObj = GetTestAsyncProxyable();

            AutoResetEvent blocker = new AutoResetEvent(false);
            string         value   = "this is a value: ".RandomString(8);
            bool?          ran     = false;

            testObj.InvokeAsync(r =>
            {
                ran = true;
                Expect.AreEqual(value, r.Result);
                blocker.Set();
            }, "Send", value);
            blocker.WaitOne(1000 * 60 * 3);

            StopServers();
            Expect.IsTrue(ran.Value);
        }