Ejemplo n.º 1
0
        public void ObjectDump_WritesObjectContents()
        {
#if ACTIVEDEBUG
            var ied = new IEmergencyDiagnostics();
#else
            var ied = new MockEmergencyDiagnostics();
#endif
            try {
                ied.Log("START OD");
                TestObject to = new TestObject();
                to.stringvalue = "arfle barfle gloop";
                Bilge sut = TestHelper.GetBilgeAndClearDown();
                ied.Log("Before Anything Done");
                var mmh = new MockMessageHandler();
                sut.AddHandler(mmh);

                sut.Info.Dump(to, "context");
                ied.Log("FLUSH OD");
                sut.Flush();
                ied.Log("FlushAfter OD");
                mmh.SetMustContainForBody("arfle barfle gloop");
                ied.Log("ASSERT OD");
                mmh.AssertAllConditionsMetForAllMessages(true, true);
            } finally {
                ied.Log("END OD");
                ied.Shutdown();
            }
        }
Ejemplo n.º 2
0
        public void Enter_WritesMethodName()
        {
            Bilge sut = TestHelper.GetBilgeAndClearDown();
            var   mmh = new MockMessageHandler();

            sut.AddHandler(mmh);
            sut.Info.E();

            sut.Flush();

            mmh.SetMustContainForBody(nameof(Enter_WritesMethodName));

            // E generates more than one message, therefore we have to check that one of the messages had the name in it.
            mmh.AssertAllConditionsMetForAllMessages(true, true);
        }
Ejemplo n.º 3
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);
        }