public void ReliableMultiSubjectProxy_AsObserver_InvalidEnvironment()
        {
            Run(client =>
            {
                var env = new TestExecutionEnvironment();
                var ctx = client.CreateContext(env);

                var uri      = new Uri("test://subject");
                var observer = new SubscriptionObserver <int>();
                var subject  = new TestSubject <int>(observer);
                env.AddArtifact(uri, subject);

                var proxy = new ReliableMultiSubjectProxy <int, int>(uri);
                var sub   = SubscribeRoot(Subscribable.Never <int>(), new ObserverToReliableObserver <int>(proxy.CreateObserver()));
                Assert.ThrowsException <InvalidOperationException>(() => new SubscriptionInitializeVisitor(sub).Initialize(ctx));
            });
        }
        public void ReliableMultiSubjectProxy_AsObserver_AsSubscription()
        {
            Run(client =>
            {
                var env = new TestReliableExecutionEnvironment();
                var ctx = client.CreateContext(env);

                var uri      = new Uri("test://subject");
                var observer = new SubscriptionObserver <int>();
                var subject  = new TestSubject <int>(observer);
                env.AddArtifact(uri, subject);

                var proxy = new ReliableMultiSubjectProxy <int, int>(uri);
                var sub   = SubscribeRoot(Subscribable.Never <int>(), new ObserverToReliableObserver <int>(proxy.CreateObserver()));
                new SubscriptionInitializeVisitor(sub).Initialize(ctx);
                Assert.IsTrue(observer.IsAcceptCalled);

                sub.Dispose();
                Assert.IsTrue(observer.IsDisposeCalled);
            });
        }