Ejemplo n.º 1
0
        private void WriteDocument(XmlWriter writer)
        {
            var Copyright = new XComment("Copyright (c) 2008-2015 New Relic, Inc.  All rights reserved.");
            Copyright.WriteTo(writer);

            var MoreInfo = new XComment("For more information see: https://newrelic.com/docs/dotnet/dotnet-agent-configuration");
            MoreInfo.WriteTo(writer);

            var CreatedBy = new XComment("Created or modified by the New Relic .Net Configuration Tool.");
            CreatedBy.WriteTo(writer);

            XRoot.WriteTo(writer);
            writer.Flush();
            writer.Close();
        }
Ejemplo n.º 2
0
        public void CommentWriteTo()
        {
            XComment c = new XComment("abcd ");

            // Null writer not allowed.
            Assert.Throws<ArgumentNullException>(() => c.WriteTo(null));

            // Test.
            StringBuilder stringBuilder = new StringBuilder();
            XmlWriter xmlWriter = XmlWriter.Create(stringBuilder);

            xmlWriter.WriteStartElement("x");
            c.WriteTo(xmlWriter);
            xmlWriter.WriteEndElement();

            xmlWriter.Flush();

            Assert.Equal("<?xml version=\"1.0\" encoding=\"utf-16\"?><x><!--abcd --></x>", stringBuilder.ToString());
        }