Ejemplo n.º 1
0
        public void Phone_CategoryFilterTest()
        {
            var engine = new WindowsPhone.Engine();
            var trace  = new TraceListener("Phone_CategoryFilterTest");

            engine.RegisterListener(trace);


            var configuration = trace.CreateDefaultConfiguration();

            configuration.Categories.Add("Filter1");
            trace.Configuration = configuration;
            engine.WriteEntry(new Entry()
            {
                Category = "Filter1", Message = "Filter1 Message"
            });
            engine.WriteEntry(new Entry()
            {
                Category = "Filter2", Message = "Filter2 Message"
            });
            engine.Flush();

            Assert.AreEqual(1, trace.Entries.Count);
            Assert.AreEqual("Filter1", trace.Entries[0].Category);
        }
Ejemplo n.º 2
0
        public void Phone_LevelFilterTest()
        {
            var engine = new WindowsPhone.Engine();
            var trace  = new TraceListener("Phone_LevelFilterTest");

            engine.RegisterListener(trace);

            var configuration = trace.CreateDefaultConfiguration();

            configuration.StartLevel = Level.Error;
            trace.Configuration      = configuration;
            engine.WriteEntry(new Entry()
            {
                Category = "Filter1", Level = PortiLog.Level.Critical, Message = "Critical Message"
            });
            engine.WriteEntry(new Entry()
            {
                Category = "Filter2", Level = PortiLog.Level.Info, Message = "Info Message"
            });
            engine.Flush();

            Assert.AreEqual(1, trace.Entries.Count);
            Assert.AreEqual(PortiLog.Level.Critical, trace.Entries[0].Level);
        }