Ejemplo n.º 1
0
        public void Manage_sub_channels_using_classes_and_interfaces_update_on_unsubscribe_all()
        {
            var es  = new EventStream(false);
            var tm1 = new CC();
            var tm2 = new CCATBT();
            var a1  = CreateTestProbe();
            var a2  = CreateTestProbe();
            var a3  = CreateTestProbe();
            var a4  = CreateTestProbe();

            es.Subscribe(a1.Ref, typeof(AT)).ShouldBeTrue();
            es.Subscribe(a2.Ref, typeof(BT)).ShouldBeTrue();
            es.Subscribe(a3.Ref, typeof(CC)).ShouldBeTrue();
            es.Subscribe(a4.Ref, typeof(CCATBT)).ShouldBeTrue();
            es.Unsubscribe(a3.Ref).ShouldBeTrue();
            es.Publish(tm1);
            es.Publish(tm2);
            a1.ExpectMsg((object)tm2);
            a2.ExpectMsg((object)tm2);
            a3.ExpectNoMsg(TimeSpan.FromSeconds(1));
            a4.ExpectMsg((object)tm2);
            es.Unsubscribe(a1.Ref, typeof(AT)).ShouldBeTrue();
            es.Unsubscribe(a2.Ref, typeof(BT)).ShouldBeTrue();
            es.Unsubscribe(a3.Ref, typeof(CC)).ShouldBeFalse();
            es.Unsubscribe(a4.Ref, typeof(CCATBT)).ShouldBeTrue();
        }
Ejemplo n.º 2
0
        public void ManageSubChannelsUsingClassesAndInterfacesUpdateOnUnsubscribe()
        {
            var es  = new EventStream(false);
            var tm1 = new CC();
            var tm2 = new CCATBT();
            var a1  = CreateTestProbe();
            var a2  = CreateTestProbe();
            var a3  = CreateTestProbe();
            var a4  = CreateTestProbe();

            es.Subscribe(a1.Ref, typeof(AT));
            es.Subscribe(a2.Ref, typeof(BT));
            es.Subscribe(a3.Ref, typeof(CC));
            es.Subscribe(a4.Ref, typeof(CCATBT));
            es.Unsubscribe(a3.Ref, typeof(CC));
            es.Publish(tm1);
            es.Publish(tm2);
            a1.ExpectMsg((object)tm2);
            a2.ExpectMsg((object)tm2);
            a3.ExpectNoMsg(TimeSpan.FromSeconds(1));
            a4.ExpectMsg((object)tm2);
            es.Unsubscribe(a1.Ref, typeof(AT)).ShouldBeTrue();
            es.Unsubscribe(a2.Ref, typeof(BT)).ShouldBeTrue();
            es.Unsubscribe(a3.Ref, typeof(CC)).ShouldBeFalse();
            es.Unsubscribe(a4.Ref, typeof(CCATBT)).ShouldBeTrue();
        }
Ejemplo n.º 3
0
        public void ManageSubChannelsUsingClassesAndInterfacesUpdateOnUnsubscribeAll()
        {
            var es  = new EventStream(false);
            var tm1 = new CC();
            var tm2 = new CCATBT();
            var a1  = TestProbe();
            var a2  = TestProbe();
            var a3  = TestProbe();
            var a4  = TestProbe();

            es.Subscribe(a1.Ref, typeof(AT)).Then(Assert.True);
            es.Subscribe(a2.Ref, typeof(BT)).Then(Assert.True);
            es.Subscribe(a3.Ref, typeof(CC)).Then(Assert.True);
            es.Subscribe(a4.Ref, typeof(CCATBT)).Then(Assert.True);
            es.Unsubscribe(a3.Ref).Then(Assert.True);
            es.Publish(tm1);
            es.Publish(tm2);
            a1.expectMsg(tm2);
            a2.expectMsg(tm2);
            a3.expectNoMsg(TimeSpan.FromSeconds(1));
            a4.expectMsg(tm2);
            es.Unsubscribe(a1.Ref, typeof(AT)).Then(Assert.True);
            es.Unsubscribe(a2.Ref, typeof(BT)).Then(Assert.True);
            es.Unsubscribe(a3.Ref, typeof(CC)).Then(Assert.False);
            es.Unsubscribe(a4.Ref, typeof(CCATBT)).Then(Assert.True);
        }
Ejemplo n.º 4
0
        public void ManageSubChannelsUsingClassesAndInterfacesUpdateOnUnsubscribeAll()
        {
            var es = new EventStream(false);
            var tm1 = new CC();
            var tm2 = new CCATBT();
            var a1 = CreateTestProbe();
            var a2 = CreateTestProbe();
            var a3 = CreateTestProbe();
            var a4 = CreateTestProbe();

            es.Subscribe(a1.Ref, typeof(AT)).ShouldBeTrue();
            es.Subscribe(a2.Ref, typeof(BT)).ShouldBeTrue();
            es.Subscribe(a3.Ref, typeof(CC)).ShouldBeTrue();
            es.Subscribe(a4.Ref, typeof(CCATBT)).ShouldBeTrue();
            es.Unsubscribe(a3.Ref).ShouldBeTrue();
            es.Publish(tm1);
            es.Publish(tm2);
            a1.ExpectMsg((object)tm2);
            a2.ExpectMsg((object)tm2);
            a3.ExpectNoMsg(TimeSpan.FromSeconds(1));
            a4.ExpectMsg((object)tm2);
            es.Unsubscribe(a1.Ref, typeof(AT)).ShouldBeTrue();
            es.Unsubscribe(a2.Ref, typeof(BT)).ShouldBeTrue();
            es.Unsubscribe(a3.Ref, typeof(CC)).ShouldBeFalse();
            es.Unsubscribe(a4.Ref, typeof(CCATBT)).ShouldBeTrue();
        }
Ejemplo n.º 5
0
        public void ManageSubChannelsUsingClassesAndInterfacesUpdateOnUnsubscribeAll()
        {
            var es = new EventStream(false);
            var tm1 = new CC();
            var tm2 = new CCATBT();
            var a1 = TestProbe();
            var a2 = TestProbe();
            var a3 = TestProbe();
            var a4 = TestProbe();

            es.Subscribe(a1.Ref, typeof(AT)).Then(Assert.True);
            es.Subscribe(a2.Ref, typeof(BT)).Then(Assert.True);
            es.Subscribe(a3.Ref, typeof(CC)).Then(Assert.True);
            es.Subscribe(a4.Ref, typeof(CCATBT)).Then(Assert.True);
            es.Unsubscribe(a3.Ref).Then(Assert.True);
            es.Publish(tm1);
            es.Publish(tm2);
            a1.expectMsg(tm2);
            a2.expectMsg(tm2);
            a3.expectNoMsg(TimeSpan.FromSeconds(1));
            a4.expectMsg(tm2);
            es.Unsubscribe(a1.Ref, typeof(AT)).Then(Assert.True);
            es.Unsubscribe(a2.Ref, typeof(BT)).Then(Assert.True);
            es.Unsubscribe(a3.Ref, typeof(CC)).Then(Assert.False);
            es.Unsubscribe(a4.Ref, typeof(CCATBT)).Then(Assert.True);
        }
Ejemplo n.º 6
0
        public void Manage_sub_channels_using_classes_and_interfaces_update_on_unsubscribe()
        {
            var es = new EventStream(false);
            var tm1 = new CC();
            var tm2 = new CCATBT();
            var a1 = CreateTestProbe();
            var a2 = CreateTestProbe();
            var a3 = CreateTestProbe();
            var a4 = CreateTestProbe();

            es.Subscribe(a1.Ref, typeof(AT));
            es.Subscribe(a2.Ref, typeof(BT));
            es.Subscribe(a3.Ref, typeof(CC));
            es.Subscribe(a4.Ref, typeof(CCATBT));
            es.Unsubscribe(a3.Ref, typeof(CC));
            es.Publish(tm1);
            es.Publish(tm2);
            a1.ExpectMsg((object)tm2);
            a2.ExpectMsg((object)tm2);
            a3.ExpectNoMsg(TimeSpan.FromSeconds(1));
            a4.ExpectMsg((object)tm2);
            es.Unsubscribe(a1.Ref, typeof(AT)).ShouldBeTrue();
            es.Unsubscribe(a2.Ref, typeof(BT)).ShouldBeTrue();
            es.Unsubscribe(a3.Ref, typeof(CC)).ShouldBeFalse();
            es.Unsubscribe(a4.Ref, typeof(CCATBT)).ShouldBeTrue();
        }