Пример #1
0
        public void CanCreateRuleDataFromCustomAttributeMatchingRuleNode()
        {
            LogCallHandlerNode handlerNode = new LogCallHandlerNode();

            handlerNode.Name          = "logHandler";
            handlerNode.AfterMessage  = "AfterMessage";
            handlerNode.BeforeMessage = "BeforeMessage";
            handlerNode.Categories.Add(new LogCategory("Cat1"));
            handlerNode.Categories.Add(new LogCategory("Cat2"));
            handlerNode.EventId                = 124;
            handlerNode.IncludeCallStack       = true;
            handlerNode.IncludeCallTime        = true;
            handlerNode.IncludeParameterValues = true;
            handlerNode.LogBehavior            = HandlerLogBehavior.After;
            handlerNode.Priority               = 123;
            handlerNode.Severity               = System.Diagnostics.TraceEventType.Error;

            LogCallHandlerData handlerData = handlerNode.CreateCallHandlerData() as LogCallHandlerData;

            Assert.IsNotNull(handlerData);
            Assert.AreEqual(handlerNode.Name, handlerData.Name);
            Assert.AreEqual(handlerNode.AfterMessage, handlerData.AfterMessage);
            Assert.AreEqual(handlerNode.BeforeMessage, handlerData.BeforeMessage);
            Assert.AreEqual(handlerNode.EventId, handlerData.EventId);
            Assert.AreEqual(handlerNode.IncludeCallStack, handlerData.IncludeCallStack);
            Assert.AreEqual(handlerNode.IncludeCallTime, handlerData.IncludeCallTime);
            Assert.AreEqual(handlerNode.IncludeParameterValues, handlerData.IncludeParameterValues);
            Assert.AreEqual(handlerNode.LogBehavior, handlerData.LogBehavior);
            Assert.AreEqual(handlerNode.Priority, handlerData.Priority);
            Assert.AreEqual(handlerNode.Severity, handlerData.Severity);
            Assert.AreEqual(handlerNode.Categories.Count, handlerData.Categories.Count);
            Assert.AreEqual(handlerNode.Categories[0].CategoryName, handlerData.Categories.Get(0).Name);
            Assert.AreEqual(handlerNode.Categories[1].CategoryName, handlerData.Categories.Get(1).Name);
        }
Пример #2
0
        public void LogCallHandlerNodeHasProperName()
        {
            LogCallHandlerNode node = new LogCallHandlerNode();

            Assert.AreEqual("Logging Handler", node.Name);
        }