Example #1
0
        public void Bilge_EnterSection_TracesSection()
        {
            var   mmh = new MockMessageHandler();
            Bilge sut = new Bilge(tl: SourceLevels.Verbose);

            sut.AddHandler(mmh);
            mmh.SetMethodNameMustContain("monkeyfish");
            sut.Info.EnterSection("random sectiion", "monkeyfish");
            sut.Flush();

            mmh.AssertAllConditionsMetForAllMessages(true, true);
        }
        public void MethodName_MatchesThisMethodName()
        {
            MockMessageHandler mmh = new MockMessageHandler();

            mmh.SetMethodNameMustContain(nameof(MethodName_MatchesThisMethodName));
            Bilge b = TestHelper.GetBilgeAndClearDown();

            b.AddHandler(mmh);
            b.Info.Log("This is a message");
            b.Flush();// (true);
            mmh.AssertAllConditionsMetForAllMessages(true);
        }
Example #3
0
        public void Bilge_LeaveSection_TracesSection()
        {
            var   mmh = new MockMessageHandler();
            Bilge sut = new Bilge(tl: SourceLevels.Verbose);

            sut.AddHandler(mmh);

            mmh.SetMethodNameMustContain("bannanaball");
            sut.Info.LeaveSection("bannanaball");

            sut.Flush();

            mmh.AssertAllConditionsMetForAllMessages(true, true);
        }
Example #4
0
        public void Flow_WritesMethodNameToMessage()
        {
            MockMessageHandler mmh = new MockMessageHandler();

            mmh.SetMethodNameMustContain(nameof(Flow_WritesMethodNameToMessage));
            mmh.SetMustContainForBody(nameof(Flow_WritesMethodNameToMessage));
            var sut = TestHelper.GetBilgeAndClearDown();

            sut.ActiveTraceLevel = SourceLevels.Verbose;
            sut.AddHandler(mmh);

            sut.Info.Flow();
            sut.Flush();

            mmh.AssertAllConditionsMetForAllMessages(true);
        }
Example #5
0
        public void Exit_WritesMethodName()
        {
            var mmh = new MockMessageHandler();

            mmh.SetMethodNameMustContain(nameof(Exit_WritesMethodName));
            Bilge sut = TestHelper.GetBilgeAndClearDown();

            sut.ActiveTraceLevel = SourceLevels.Verbose;
            sut.AddHandler(mmh);
            sut.Info.X();

            sut.Flush();

            // X generates more than one message, therefore we have to check that one of the messages had the name in it.
            mmh.AssertAllConditionsMetForAllMessages(true, true);
        }
Example #6
0
        public void Action_WhenExecuted_WritesToTraceStream()
        {
            var mmh = new MockMessageHandler();

            mmh.SetMethodNameMustContain(nameof(Action_WhenExecuted_WritesToTraceStream));
            Bilge sut = TestHelper.GetBilgeAndClearDown();

            sut.ActiveTraceLevel = SourceLevels.Verbose;
            sut.AddHandler(mmh);
            Assert.Equal(0, mmh.TotalMessagesRecieved);
            sut.Action.Occured("test", "test");

            sut.Flush();



            Assert.True(mmh.TotalMessagesRecieved > 0);
        }