Exemple #1
0
        public void Watcher_Retry_Ok()
        {
            var fakeIFileSystemWatcher = new FakeIFileSystemWatcherWrapper();

            var result = new DiskWatcher(fakeIFileSystemWatcher, _scopeFactory).Retry(fakeIFileSystemWatcher);

            Assert.IsTrue(result);
        }
Exemple #2
0
        public void Watcher_CrashAnd_Retry()
        {
            var fakeIFileSystemWatcher = new FakeIFileSystemWatcherWrapper()
            {
                CrashOnEnableRaisingEvents = true
            };

            fakeIFileSystemWatcher.EnableRaisingEvents = false;

            var result = new DiskWatcher(fakeIFileSystemWatcher, _scopeFactory).Retry(fakeIFileSystemWatcher, 1, 0);

            Assert.IsFalse(result);
        }
 /// <summary>
 /// Factory method for creating a new instance of DiskWatcherCheckResult.
 /// </summary>
 /// <param name="watcher">Instance of DiskWatcher.</param>
 /// <param name="isValid">Flag determining whether the performed check was valid.</param>
 /// <param name="diskCheck">Instance of DiskCheck.</param>
 /// <param name="description">Custom description of the performed check.</param>
 /// <returns>Instance of DiskWatcherCheckResult.</returns>
 public static DiskWatcherCheckResult Create(DiskWatcher watcher, bool isValid,
                                             DiskCheck diskCheck, string description = "")
 => new DiskWatcherCheckResult(watcher, isValid, description, diskCheck);
 protected DiskWatcherCheckResult(DiskWatcher watcher, bool isValid, string description,
                                  DiskCheck diskCheck)
     : base(watcher, isValid, description)
 {
     DiskCheck = diskCheck;
 }