Ejemplo n.º 1
0
        //[TEST_METHOD]
        public void SimpleNetworkTimeout()
        {
            using (new SelfHoster())
                using (new NetworkChannelScope("network:", true))
                {
                    var networkchannel = new NetworkChannel <int>("network:test");

                    var res = networkchannel.AsRead().ReadAsync(TimeSpan.FromSeconds(1));
                    res.WaitForTask();

                    if (!res.IsFaulted || !res.Exception.IsTimeoutException())
                    {
                        throw new UnittestException("Broken timeout implementation");
                    }

                    var wrtask = networkchannel.WriteAsync(42);

                    if (networkchannel.AsRead().Read(TimeSpan.FromSeconds(1)) != 42)
                    {
                        throw new UnittestException("Broken network channel");
                    }

                    wrtask.WaitForTaskOrThrow();
                }
        }
Ejemplo n.º 2
0
        //[TEST_METHOD]
        public void SimpleNetwork()
        {
            using (new SelfHoster())
                using (new NetworkChannelScope("network:", true))
                {
                    var networkchannel = new NetworkChannel <int>("network:test");

                    var wrtask = networkchannel.WriteAsync(42);
                    var res    = networkchannel.AsRead().Read();
                    if (res != 42)
                    {
                        throw new UnittestException("Broken network channel");
                    }

                    wrtask.WaitForTaskOrThrow();
                }
        }