示例#1
0
            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);
                }
            }
示例#2
0
        public void TestMethod9()
        {
            StubExtensionManager stubManger = new StubExtensionManager();
            FileChecker          fc         = new FileChecker(stubManger);

            bool ret = fc.CheckFile("myfile");

            Assert.AreEqual(true, ret);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
 public void When_FileOK_DoesntThrowException()
 {
     FileChecker.CheckFile(@"TestFiles\TestSolution_1_0_0_0_managed.zip");
 }