Exemplo n.º 1
0
        public void TimeStampRound()
        {
            var le    = CreateLoggingEvent();
            var stamp = new log4net.Util.Stamps.TimeStamp()
            {
                Round = true
            };

            stamp.StampEvent(le);
            var value = Convert.ToString(le.Properties["stamp"]);
            var time  = 0L;

            Assert.IsTrue(long.TryParse(value, out time), "{0} must be a long when Round=true", value);
        }
Exemplo n.º 2
0
        public void TimeStamp()
        {
            var le     = CreateLoggingEvent();
            var stamp  = new log4net.Util.Stamps.TimeStamp();
            var stamp2 = new log4net.Util.Stamps.TimeStamp()
            {
                Name = "stamp2"
            };

            stamp.StampEvent(le);
            stamp2.StampEvent(le);

            Assert.That(le.Properties["stamp"], Is.Not.Null, @"Properties[""stamp""]");
            Assert.That(le.Properties["stamp2"], Is.Not.Null, @"Properties[""stamp2""]");
            Assert.Greater((double)le.Properties["stamp2"], (double)le.Properties["stamp"], @"stamp2 > stamp");
        }