예제 #1
0
        public void Ctor_Where_Seed_Has_Same_Message_Types_But_Using_Different_Type_Headers_Results_In_An_Collection_With_Two_Items()
        {
            this.c_SUT = new MessageConsumers(
                new[]
            {
                new  MessageConsumer(
                    typeof(MyEvent),
                    "Q_1",
                    "TYPE_HEADER_1",
                    message => ConsumerHandlerResult.Completed),
                new  MessageConsumer(
                    typeof(MyEvent),
                    "Q_2",
                    "TYPE_HEADER_2",
                    message => ConsumerHandlerResult.Completed)
            });

            Assert.IsNotNull(this.c_SUT);
            Assert.AreEqual(2, this.c_SUT.Count());
            Assert.IsTrue(this.c_SUT.HasConfiguration("TYPE_HEADER_1"));
            Assert.IsNotNull(this.c_SUT["TYPE_HEADER_1"]);
            Assert.IsTrue(this.c_SUT.HasConfiguration("TYPE_HEADER_2"));
            Assert.IsNotNull(this.c_SUT["TYPE_HEADER_2"]);
            Assert.AreEqual(new[] { "Q_1", "Q_2" }, this.c_SUT.GetDistinctQueueNames().ToArray());
        }
예제 #2
0
        public void Ctor_Where_Empty_Seed_Results_In_Empty_Collection()
        {
            this.c_SUT = new MessageConsumers(new MessageConsumer[0]);

            Assert.IsNotNull(this.c_SUT);
            Assert.AreEqual(0, this.c_SUT.Count());
        }
예제 #3
0
 public void Ctor_Where_Duplicate_Seed_Item_Type_Headers_Results_In_An_Exception()
 {
     this.c_SUT = new MessageConsumers(
         new[]
     {
         new  MessageConsumer(
             typeof(MyEvent),
             TestingConfiguration.QueueName,
             "** DUPLICATE_TYPE_HEADER ***",
             message => ConsumerHandlerResult.Completed),
         new  MessageConsumer(
             typeof(MyEvent),
             TestingConfiguration.QueueName,
             "** DUPLICATE_TYPE_HEADER ***",
             message => ConsumerHandlerResult.Completed)
     });
 }
예제 #4
0
        public void Ctor_Where_Single_Item_Seed_Results_In_Single_Item_Collection()
        {
            this.c_SUT = new MessageConsumers(
                new []
            {
                new  MessageConsumer(
                    typeof(MyEvent),
                    TestingConfiguration.QueueName,
                    typeof(MyEvent).Name,
                    message => ConsumerHandlerResult.Completed)
            });

            Assert.IsNotNull(this.c_SUT);
            Assert.AreEqual(1, this.c_SUT.Count());
            Assert.IsTrue(this.c_SUT.HasConfiguration(typeof(MyEvent).Name));
            Assert.IsNotNull(this.c_SUT[typeof(MyEvent).Name]);
            Assert.AreEqual(new[] { TestingConfiguration.QueueName }, this.c_SUT.GetDistinctQueueNames().ToArray());
        }