public void LogHandlingError() { Exception ex = new Exception("Unable to init crypto"); CryptographyUtility.LogCryptographyException(ex); using (EventLog log = new EventLog(EventLogName)) { EventLogEntry entry = log.Entries[log.Entries.Count - 1]; Assert.AreEqual(EventLogEntryType.Error, entry.EntryType); Assert.AreEqual(EventLogSource, entry.Source); } }