public void WhenAReconfigurationErrorIsNotified_ThenItIsLoggedThroughWmi()
        {
            DateTime testStartTime = DateTime.Now;
            Thread.Sleep(1500); // Log granularity is to the second, force us to the next second

            using (var eventLog = new EventLog("Application", ".", "Enterprise Library Logging"))
            {
                this.provider.FireReconfigurationErrorEvent(new Exception("test message"));

                var entries =
                    eventLog.GetEntriesSince(testStartTime).Where(entry => entry.Message.IndexOf("test message") > -1);

                Assert.AreEqual(0, entries.Count());
            }
        }
        public void CreatingDatabaseWithUnknownInstanceNameWritesToEventLog()
        {
            var startTime = DateTime.Now;
            Thread.Sleep(1000);
            try
            {
                Database db = DatabaseFactory.CreateDatabase("ThisIsAnUnknownKey");
            }
            catch (ActivationException)
            {
                using (EventLog applicationLog = new EventLog("Application"))
                {
                    var entries = applicationLog.GetEntriesSince(startTime)
                        .Where(e => e.Source == "Enterprise Library Data" &&
                            e.Message.Contains("ThisIsAnUnknownKey"));

                    Assert.AreEqual(1, entries.Count());
                }
                return;
            }

            Assert.Fail("ActivationException expected");
        }