Exemplo n.º 1
0
        public void ShouldSubscribeAndUnsubscribe()
        {
            var eventBase = new TestableEventBase();

            var eventSubscription = new MockEventSubscription();
            eventBase.Subscribe(eventSubscription);

            Assert.IsNotNull(eventSubscription.SubscriptionToken);
            Assert.IsTrue(eventBase.Contains(eventSubscription.SubscriptionToken));

            eventBase.Unsubscribe(eventSubscription.SubscriptionToken);

            Assert.IsFalse(eventBase.Contains(eventSubscription.SubscriptionToken));
        }
Exemplo n.º 2
0
		public void ShouldSubscribeAndUnsubscribe()
		{
			var eventBase = new TestableEventBase();

			var eventSubscription = new MockEventSubscription();
			eventBase.Subscribe(eventSubscription);

			Assert.NotNull(eventSubscription.SubscriptionToken);
			Assert.True(eventBase.Contains(eventSubscription.SubscriptionToken));

			eventBase.Unsubscribe(eventSubscription.SubscriptionToken);

			Assert.False(eventBase.Contains(eventSubscription.SubscriptionToken));
		}
Exemplo n.º 3
0
		public void WhenEventSubscriptionActionIsNullPruneItFromList()
		{
			var eventBase = new TestableEventBase();
			var eventSubscription = new MockEventSubscription { GetPublishActionReturnValue = null };
			var token = eventBase.Subscribe(eventSubscription);
			eventBase.Publish();
			Assert.False(eventBase.Contains(token));
		}
        public void WhenEventSubscriptionActionIsNullPruneItFromList()
        {
            var eventBase = new TestableEventBase();

            var eventSubscription = new MockEventSubscription();
            eventSubscription.GetPublishActionReturnValue = null;

            var token = eventBase.Subscribe(eventSubscription);

            eventBase.Publish();

            Assert.IsFalse(eventBase.Contains(token));
        }