Exemple #1
0
        public void PublishedTestEvent()
        {
            var options = new BusOptions {
                ExchangeName = "TestExchange1", HostName = "Localhost", Port = 5672, Username = "******", Password = "******"
            };

            using (var consumer = new TestDispatcher(options))
                using (var target = new EventPublisher(options))
                {
                    target.Publish(new TestEvent());

                    Thread.Sleep(100);

                    Assert.AreEqual(1, consumer.receivedTestEventCount);
                }
        }
Exemple #2
0
        public void PublishedTestEventMultiple()
        {
            var options = new BusOptions {
                ExchangeName = "TestExchange6", HostName = "Localhost", Port = 5672, Username = "******", Password = "******"
            };

            using (var consumer = new TestDispatcher(options))
                using (var consumerAttribute = new TestDispatcherWithoutOtherEvent(options))
                    using (var target = new EventPublisher(options))
                    {
                        target.Publish(new TestEvent());
                        target.Publish(new OtherTestEvent());

                        Thread.Sleep(100);

                        Assert.AreEqual(1, consumer.receivedTestEventCount);
                        Assert.AreEqual(1, consumer.receivedOtherTestEventCount);
                        Assert.AreEqual(2, consumer.receivedTotalTestCount);

                        Assert.AreEqual(1, consumerAttribute.receivedTestEventCount);
                    }
        }