コード例 #1
0
        public void CustomTraceListenerNodeDefaults()
        {
            CustomTraceListenerNode customListener = new CustomTraceListenerNode();

            Assert.AreEqual("Custom Trace Listener", customListener.Name);
            Assert.IsNull(customListener.Type);
        }
コード例 #2
0
        public void CustomTraceListenerNodeTest()
        {
            string attributeKey = "attKey";
            string attributeValue = "attValue";
            string name = "some name";
            Type type = typeof(FormattedEventLogTraceListener);

            CustomTraceListenerNode customTraceListenerNode = new CustomTraceListenerNode();
            customTraceListenerNode.Attributes.Add(new EditableKeyValue(attributeKey, attributeValue));
            customTraceListenerNode.Name = name;
            customTraceListenerNode.Type = type;
            ApplicationNode.AddNode(customTraceListenerNode);

            CustomTraceListenerData nodeData = (CustomTraceListenerData)customTraceListenerNode.TraceListenerData;

            Assert.AreEqual(name, nodeData.Name);
            Assert.AreEqual(type, nodeData.Type);
            Assert.AreEqual(attributeKey, nodeData.Attributes.AllKeys[0]);
            Assert.AreEqual(attributeValue, nodeData.Attributes[attributeKey]);
        }
コード例 #3
0
        public void CustomTraceListenerDataTest()
        {
            string attributeKey = "attKey";
            string attributeValue = "attValue";
            string name = "some name";
            Type type = typeof(FormattedEventLogTraceListener);

            CustomTraceListenerData data = new CustomTraceListenerData();
            data.Name = name;
            data.Type = type;

            data.Attributes.Add(attributeKey, attributeValue);

            CustomTraceListenerNode node = new CustomTraceListenerNode(data);

            Assert.AreEqual(name, node.Name);
            Assert.AreEqual(type, node.Type);
            Assert.AreEqual(attributeKey, node.Attributes[0].Key);
            Assert.AreEqual(attributeValue, node.Attributes[0].Value);
        }