public void LogMonitorTest()
        {
            var monitor = new SharePointLogMonitor();
            var path    = Path.Combine(dir, file);

            try
            {
                //create monitor
                var settings = new SharePointLogMonitorSettings()
                {
                    Directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dir),
                    Interval  = 30
                };

                monitor.MonitorDirectory = settings.Directory;
                monitor.Interval         = settings.Interval.Value;
                monitor.Start();
                Assert.IsTrue(monitor.MonitorDirectory == settings.Directory);
                Assert.IsTrue(monitor.Interval == settings.Interval);

                //create log file and let monitor take initial count
                File.Copy(SharePointLogFileTests.good_SPTestFile, path);
                Thread.Sleep(settings.Interval.Value * _intervalMulti);
                var count1 = monitor.LogSet.Entries.Count;
                monitor.Stop();
                monitor.Start();

                using (var append = new StreamReader(File.Open(SharePointLogFileTests.good_SPTestFile, FileMode.Open)))
                {
                    append.ReadLine();
                    var entry = append.ReadLine();
                    File.AppendAllText(path, entry, Encoding.Unicode);//-add 1 entry-
                }

                Thread.Sleep(settings.Interval.Value * _intervalMulti);
                var count2 = monitor.LogSet.Entries.Count;
                Assert.IsTrue((count1 + 1) == count2);//-check that 1 entry was added-
            }
            catch (Exception ex)
            {
                if (ex is AssertFailedException)
                {
                    throw;
                }
            }
            finally
            {
                monitor.Stop();
                File.Delete(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path));
                monitor.Dispose();
            }
        }
        /// <summary>
        /// Chesks for permissions and creates a new SharePoing log monitor.
        /// Throws SecurityException if cannot create monitor.
        /// </summary>
        private void CreateSPLogMonitor()
        {
            try
            {
                var perms = new PermissionSet(PermissionState.Unrestricted);
                perms.Demand();
                _spLogMonitor = new SharePointLogMonitor()
                {
                    MonitorDirectory = _spLogMonitorSettings.Directory,
                    Interval         = _spLogMonitorSettings.Interval.Value
                };

                var path = _spLogMonitorSettings.Directory;
                if (_spLogMonitorSettings.Directory.Length > 20)
                {
                    path = string.Concat(_spLogMonitorSettings.Directory.Substring(0, 18), "...");
                }
            }
            catch (SecurityException)
            {
                MessageBox.Show("You do not have the required systems permissions to start log monitoring! Please restart the utility using an Administrator account.",
                                "Permissions Error!!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }