示例#1
0
        public void AddHandler_SingleName_AddsDifferentNames()
        {
            _ = TestHelper.GetBilgeAndClearDown();

            Bilge.AddHandler(new MockMessageHandler("arfle"), HandlerAddOptions.SingleName);
            Bilge.AddHandler(new MockMessageHandler("barfle"), HandlerAddOptions.SingleName);
            var ct = Bilge.GetHandlers().Count();

            Assert.Equal(2, ct);
        }
示例#2
0
        public void AddHandler_SingleName_DoesNotAddSecondName()
        {
            _ = TestHelper.GetBilgeAndClearDown();

            Bilge.AddHandler(new MockMessageHandler("arfle"), HandlerAddOptions.SingleName);
            Bilge.AddHandler(new MockMessageHandler("arfle"), HandlerAddOptions.SingleName);
            var ct = Bilge.GetHandlers().Count();

            Assert.Equal(1, ct);
        }
示例#3
0
        public void AddHandler_SingleType_AddsDifferentTypes()
        {
            _ = TestHelper.GetBilgeAndClearDown();

            Bilge.AddHandler(new MockMessageHandler(), HandlerAddOptions.SingleType);
            Bilge.AddHandler(new InMemoryHandler(), HandlerAddOptions.SingleType);
            var ct = Bilge.GetHandlers().Count();

            Assert.Equal(2, ct);
        }
示例#4
0
        public void AddHandler_DoesAddHandler()
        {
            _ = TestHelper.GetBilgeAndClearDown();

            bool worked = Bilge.AddHandler(new MockMessageHandler());
            var  count  = Bilge.GetHandlers().Count();

            Assert.True(worked);
            Assert.Equal(1, count);
        }
示例#5
0
        public void GetHandlers_FilterReturnsNamed()
        {
            _ = TestHelper.GetBilgeAndClearDown();

            Bilge.AddHandler(new MockMessageHandler("arfle"));
            Bilge.AddHandler(new MockMessageHandler("barfle"));
            var count = Bilge.GetHandlers("arf*").Count();

            Assert.Equal(1, count);
        }
示例#6
0
        public void GetHandlers_DefaultReturnsAll()
        {
            _ = TestHelper.GetBilgeAndClearDown();

            Bilge.AddHandler(new MockMessageHandler());
            Bilge.AddHandler(new MockMessageHandler());
            Bilge.AddHandler(new MockMessageHandler());
            Bilge.AddHandler(new MockMessageHandler());

            Assert.Equal(4, Bilge.GetHandlers().Count());
        }
示例#7
0
        public void AddHandler_DuplicateByNameFailsOnSecond()
        {
            _ = TestHelper.GetBilgeAndClearDown();

            Bilge.AddHandler(new MockMessageHandler());
            Bilge.AddHandler(new MockMessageHandler());

            var ct = Bilge.GetHandlers().Count();

            Assert.Equal(2, Bilge.GetHandlers().Count());
        }
示例#8
0
        public void AddHandler_DuplicateAddsTwoHandlers()
        {
            _ = TestHelper.GetBilgeAndClearDown();

            bool worked = Bilge.AddHandler(new MockMessageHandler());

            worked &= Bilge.AddHandler(new MockMessageHandler());

            Assert.True(worked);
            var ct = Bilge.GetHandlers().Count();

            Assert.Equal(2, ct);
        }