public void LayoutInitTest1()
        {
            var lr = new MockLayout();
            Assert.AreEqual(0, lr.InitCount);
            Assert.AreEqual(0, lr.CloseCount);

            // make sure render will call Init
            lr.Render(LogEventInfo.CreateNullEvent());
            Assert.AreEqual(1, lr.InitCount);
            Assert.AreEqual(0, lr.CloseCount);

            ((ISupportsInitialize)lr).Close();
            Assert.AreEqual(1, lr.InitCount);
            Assert.AreEqual(1, lr.CloseCount);

            // second call to Close() will be ignored
            ((ISupportsInitialize)lr).Close();
            Assert.AreEqual(1, lr.InitCount);
            Assert.AreEqual(1, lr.CloseCount);
        }
        public void LayoutInitTest1()
        {
            var lr = new MockLayout();
            Assert.Equal(0, lr.InitCount);
            Assert.Equal(0, lr.CloseCount);

            // make sure render will call Init
            lr.Render(LogEventInfo.CreateNullEvent());
            Assert.Equal(1, lr.InitCount);
            Assert.Equal(0, lr.CloseCount);

            lr.Close();
            Assert.Equal(1, lr.InitCount);
            Assert.Equal(1, lr.CloseCount);

            // second call to Close() will be ignored
            lr.Close();
            Assert.Equal(1, lr.InitCount);
            Assert.Equal(1, lr.CloseCount);
        }
        public void LayoutInitTest2()
        {
            var lr = new MockLayout();
            Assert.Equal(0, lr.InitCount);
            Assert.Equal(0, lr.CloseCount);

            // calls to Close() will be ignored because 
            lr.Close();
            Assert.Equal(0, lr.InitCount);
            Assert.Equal(0, lr.CloseCount);

            lr.Initialize(null);
            Assert.Equal(1, lr.InitCount);

            // make sure render will not call another Init
            lr.Render(LogEventInfo.CreateNullEvent());
            Assert.Equal(1, lr.InitCount);
            Assert.Equal(0, lr.CloseCount);

            lr.Close();
            Assert.Equal(1, lr.InitCount);
            Assert.Equal(1, lr.CloseCount);
        }
Exemple #4
0
        public void LayoutInitTest2()
        {
            var lr = new MockLayout();
            Assert.AreEqual(0, lr.InitCount);
            Assert.AreEqual(0, lr.CloseCount);

            // calls to Close() will be ignored because
            ((ISupportsInitialize)lr).Close();
            Assert.AreEqual(0, lr.InitCount);
            Assert.AreEqual(0, lr.CloseCount);

            using(lr.Initialize(CommonCfg))
            {
                Assert.AreEqual(1, lr.InitCount);

                // make sure render will not call another Init
                lr.Render(LogEventInfo.CreateNullEvent());
                Assert.AreEqual(1, lr.InitCount);
                Assert.AreEqual(0, lr.CloseCount);
            }
            Assert.AreEqual(1, lr.InitCount);
            Assert.AreEqual(1, lr.CloseCount);
        }
        public void LayoutInitTest2()
        {
            var lr = new MockLayout();
            Assert.AreEqual(0, lr.InitCount);
            Assert.AreEqual(0, lr.CloseCount);

            // calls to Close() will be ignored because 
            lr.Close();
            Assert.AreEqual(0, lr.InitCount);
            Assert.AreEqual(0, lr.CloseCount);

            lr.Initialize(null);
            Assert.AreEqual(1, lr.InitCount);

            // make sure render will not call another Init
            lr.Render(LogEventInfo.CreateNullEvent());
            Assert.AreEqual(1, lr.InitCount);
            Assert.AreEqual(0, lr.CloseCount);

            lr.Close();
            Assert.AreEqual(1, lr.InitCount);
            Assert.AreEqual(1, lr.CloseCount);
        }