Example #1
0
        public void AuditEventInfo_EncodeProperty()
        {
            var testEvent = new TestAuditEvent();
            var eventInfo = new AuditEventInfo(testEvent, new Dictionary <string, object>()
            {
                { "Prop1", "<a>html value &'\"</a>" }
            });

            var xDoc = new XmlDocument();

            xDoc.LoadXml(eventInfo.FormattedMessage);

            // Note: we use the InnerXml property instead of InnerText because it gives us
            // the raw (undecoded) value instead of a decoded xml format.
            var propValue = xDoc.SelectSingleNode("/LogEntry/ExtendedProperties/Prop1")?.InnerXml;

            Assert.AreEqual("&lt;a&gt;html value &amp;'\"&lt;/a&gt;", propValue);
        }
Example #2
0
        // ====================================================== Audit log

        public abstract void WriteAuditEvent(AuditEventInfo auditEvent);
Example #3
0
        /* =============================================================================================== Logging */

        public Task WriteAuditEventAsync(AuditEventInfo auditEvent, CancellationToken cancellationToken)
        {
            return(DataProvider.WriteAuditEventAsync(auditEvent, cancellationToken));
        }