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("<a>html value &'\"</a>", propValue); }
// ====================================================== Audit log public abstract void WriteAuditEvent(AuditEventInfo auditEvent);
/* =============================================================================================== Logging */ public Task WriteAuditEventAsync(AuditEventInfo auditEvent, CancellationToken cancellationToken) { return(DataProvider.WriteAuditEventAsync(auditEvent, cancellationToken)); }