public void Get_instance_with_events_calls_inner()
        {
            ConnectionStub<IMyProxy> inner = new ConnectionStub<IMyProxy>();
            MyProxyStub proxyStub = new MyProxyStub();
            inner.Instance = proxyStub;
            ConnectionWithEvents<IMyProxy> outer = new ConnectionWithEvents<IMyProxy>(inner, ClientEventSource.Instance, Guid.Empty);

            Assert.Same(proxyStub, outer.Instance);
        }
        public void Get_instance_with_events_calls_inner()
        {
            ConnectionStub <IMyProxy> inner = new ConnectionStub <IMyProxy>();
            MyProxyStub proxyStub           = new MyProxyStub();

            inner.Instance = proxyStub;
            ConnectionWithEvents <IMyProxy> outer = new ConnectionWithEvents <IMyProxy>(inner, ClientEventSource.Instance, Guid.Empty);

            Assert.Same(proxyStub, outer.Instance);
        }
Esempio n. 3
0
        public void Invoke_connects_and_invokes_method_with_exception_and_invalidates()
        {
            ConnectionManagerStub connectionManagerStub = new ConnectionManagerStub();
            MyProxyStub           proxyStub             = new MyProxyStub();

            connectionManagerStub.Proxy = proxyStub;
            ProxyInvoker <IMyProxy> invoker = new ProxyInvoker <IMyProxy>(connectionManagerStub);

            InvalidTimeZoneException expectedException = new InvalidTimeZoneException("Expected.");

            proxyStub.Exception = expectedException;
            Task <object> task = invoker.InvokeAsync(p => p.DoAsync(new object()));

            Assert.Equal(TaskStatus.Faulted, task.Status);
            AggregateException ae = Assert.IsType <AggregateException>(task.Exception);

            Assert.Equal(1, ae.InnerExceptions.Count);
            Assert.Same(expectedException, ae.InnerExceptions[0]);
            Assert.Equal(1, connectionManagerStub.InvalidateCount);
        }