void CallFileCheck() { if (!isActive) { return; } if (timer == null) { WeakReference weakReference = new WeakReference(this); timer = new Timer(new TimerCallback((o) => { FileChecker fc = (FileChecker)weakReference.Target; if (fc != null) { fc.CheckFile(); fc.CallFileCheck(); } }), null, checkIntervall, Timeout.InfiniteTimeSpan); } else { timer.Change(checkIntervall, Timeout.InfiniteTimeSpan); } }
public void TestMethod9() { StubExtensionManager stubManger = new StubExtensionManager(); FileChecker fc = new FileChecker(stubManger); bool ret = fc.CheckFile("myfile"); Assert.AreEqual(true, ret); }
public void TestMethod1() { //Act StubExtensionManager stub = new StubExtensionManager(); FileChecker checker = new FileChecker(stub); //Action bool IsTrueFile = checker.CheckFile("myFile.whatever"); //Assert Assert.AreEqual(true, IsTrueFile); }
public void When_CustomizationsDoNotHaveSitemap_Throws_SaysNoSiteMapFound() { Exception ex = Assert.ThrowsException <Exception>(() => FileChecker.CheckFile(@"TestFiles\TestSolution_1_0_0_0_managed_no_sitemap.zip")); Assert.AreEqual("No sitemap inside customizations.xml", ex.Message); }
public void When_ValidZipButNoCustomizations_Throws_SaysFileNotFound() { Exception ex = Assert.ThrowsException <Exception>(() => FileChecker.CheckFile(@"TestFiles\TestSolution_1_0_0_0_with_no_customizations.zip")); Assert.AreEqual("File customizations.xml not found in zip", ex.Message); }
public void When_NotAValidZip_Throws_SaysNotValidZip() { Exception ex = Assert.ThrowsException <Exception>(() => FileChecker.CheckFile(@"TestFiles\this_is_not_a_zip.zip")); Assert.AreEqual("Cannot read that as a ZipFile", ex.Message); }
public void When_FileDoesntExists_Throws_SaysFileNotFound() { Exception ex = Assert.ThrowsException <Exception>(() => FileChecker.CheckFile(@"TestFiles\does_not_exists.zip")); Assert.AreEqual("File not found", ex.Message); }
public void When_FileOK_DoesntThrowException() { FileChecker.CheckFile(@"TestFiles\TestSolution_1_0_0_0_managed.zip"); }