示例#1
0
        public void Channel_PublishingEventClosedChannel_IsNotListened()
        {
            var channelName = "custom_closed_event";
            var channel     = new ServiceBusMessageChannel(Configuration);

            var task = WarpSubscription <MyEvent>(channel, _event =>
            {
                Assert.Equal(Message, _event.Message);
                Assert.Equal(Timestamp, _event.Timestamp);
            }, channelName: channelName);

            Thread.Sleep(1000);
            channel.Close().Wait();

            channel.Publish(channelName, Event).Wait();
            Thread.Sleep(1000);

            Assert.False(task.Result);


            var purge = WarpSubscription <MyEvent>(channel, _event =>
            {
            }, channelName: channelName);

            Thread.Sleep(1000);
            Assert.True(purge.Result);
        }
示例#2
0
        public void Channel_PublishingEvent_IsListened()
        {
            var channel = new ServiceBusMessageChannel(Configuration);

            var task = WarpSubscription <MyEvent>(channel, _event =>
            {
                Assert.Equal(Message, _event.Message);
                Assert.Equal(Timestamp, _event.Timestamp);
            });

            Thread.Sleep(1000);
            channel.Publish(Event).Wait();
            Thread.Sleep(1000);

            Assert.True(task.Result);
            channel.Close().Wait();
        }