public void TestErrorLogNonExistingSourceExistsReturnsTrue() { EventLogShim.Initialize(); bool result = System.Diagnostics.EventLog.SourceExists("80EF6F32-0316-484D-B179-BBE0425CB854", "."); Assert.IsTrue(result); }
public void TestErrorLogExistingSourceExistsReturnsTrue() { EventLogShim.Initialize(); bool result = System.Diagnostics.EventLog.SourceExists("MsiInstaller", "."); Assert.IsTrue(result); }
public void TestErrorLogEntryWritesToErr() { var source = nameof(TestEventLogShim); var msg = "Hello, world!"; var sb = new StringBuilder(); Console.SetError(new StringWriter(sb)); EventLogShim.Initialize(); System.Diagnostics.EventLog.WriteEntry(source, msg, System.Diagnostics.EventLogEntryType.Error); Assert.AreEqual(1, EventLogShim.Instance.InvocationCheck); Assert.AreEqual($"{source}: {msg}\r\n", sb.ToString()); }
public void TestShim() { EventLogShim.Initialize(); System.Diagnostics.EventLog.WriteEntry(nameof(TestEventLogShim), "Hello, world!"); Assert.AreEqual(1, EventLogShim.Instance.InvocationCheck); }