Exemple #1
0
        public void Should_NotDownloadInstaller_InstalledVersionHigherOrEqualOnlineVersion()
        {
            // Arrange
            var    mockHelper   = new Mock <IRunnerHelper>();
            string minorVersion = "69";

            mockHelper.Setup(s => s.LoadXmlDocument(It.IsAny <string>())).Returns(LavFiltersMetadataFile("0", minorVersion, "0", "0"));
            string splitterKey = @"CLSID\{171252A0-8820-4AFE-9DF8-5C92B2D66B04}\InprocServer32";
            string fileName    = "LavSplitter.ax";

            mockHelper.Setup(s => s.GetPathForRegistryKey(splitterKey)).Returns(fileName);
            mockHelper.Setup(s => s.GetFileMajorVersion(fileName)).Returns(0);
            int localMinorVersion = 70;

            mockHelper.Setup(s => s.GetFileMinorVersion(fileName)).Returns(localMinorVersion);
            mockHelper.Setup(s => s.GetFileBuildVersion(fileName)).Returns(0);
            mockHelper.Setup(s => s.GetFilePrivateVersion(fileName)).Returns(0);

            // Act
            var  runner    = new CustomActionRunner(mockHelper.Object);
            bool installed = runner.IsLavFiltersAlreadyInstalled();

            // Assert
            Assert.Equal(true, installed);
        }
Exemple #2
0
        public void Should_DownloadInstaller_InstalledVersionLowerThanOnline()
        {
            // Arrange
            var    mockHelper         = new Mock <IRunnerHelper>();
            string majorOnlineversion = "0";
            string minorOnlineVersion = "69";
            string buildOnlineVersion = "0";
            string privOnlineVersion  = "42";

            mockHelper.Setup(s => s.LoadXmlDocument(It.IsAny <string>())).Returns(LavFiltersMetadataFile(majorOnlineversion, minorOnlineVersion, buildOnlineVersion, privOnlineVersion));
            string splitterKey = @"CLSID\{171252A0-8820-4AFE-9DF8-5C92B2D66B04}\InprocServer32";
            string fileName    = "LavSplitter.ax";

            mockHelper.Setup(s => s.GetPathForRegistryKey(splitterKey)).Returns(fileName);

            int localMajorVersion = 0;
            int localMinorVersion = 69;
            int localBuildVersion = 0;
            int localPrivVersion  = 33;

            mockHelper.Setup(s => s.GetFileMajorVersion(fileName)).Returns(localMajorVersion);
            mockHelper.Setup(s => s.GetFileMinorVersion(fileName)).Returns(localMinorVersion);
            mockHelper.Setup(s => s.GetFileBuildVersion(fileName)).Returns(localBuildVersion);
            mockHelper.Setup(s => s.GetFilePrivateVersion(fileName)).Returns(localPrivVersion);

            // Act
            var  runner    = new CustomActionRunner(mockHelper.Object);
            bool installed = runner.IsLavFiltersAlreadyInstalled();

            // Assert
            Assert.Equal(false, installed);
        }
Exemple #3
0
        public void Should_FailToInstallPackage_TimeoutOccured()
        {
            // Arrange
            var mockHelper = new Mock <IRunnerHelper>();

            mockHelper.Setup(s => s.Start(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>())).Returns(false);

            // Act
            var  runner      = new CustomActionRunner(mockHelper.Object);
            bool isInstalled = runner.InstallLavFilters();

            // Assert
            Assert.Equal(false, isInstalled);
        }
Exemple #4
0
        public void Should_NotInstallPackage_DownloadFailed()
        {
            // Arrange
            var mockHelper = new Mock <IRunnerHelper>();

            mockHelper.Setup(s => s.DownloadFileAndReleaseResources(It.IsAny <string>(), It.IsAny <string>())).Verifiable();
            mockHelper.Setup(s => s.Exists(It.IsAny <string>())).Returns(false);

            // Act
            var  runner       = new CustomActionRunner(mockHelper.Object);
            bool isDownloaded = runner.IsLavFiltersDownloaded();

            // Assert
            Assert.Equal(false, isDownloaded);
        }
Exemple #5
0
        public void Should_DownloadInstaller_LavNotInstalledOnSystem()
        {
            // Arrange
            var    mockHelper  = new Mock <IRunnerHelper>();
            string splitterKey = @"CLSID\{171252A0-8820-4AFE-9DF8-5C92B2D66B04}\InprocServer32";

            mockHelper.Setup(s => s.GetPathForRegistryKey(splitterKey)).Returns(string.Empty);
            string minorOnlineVersion = "69";

            mockHelper.Setup(s => s.LoadXmlDocument(It.IsAny <string>())).Returns(LavFiltersMetadataFile("0", minorOnlineVersion, "0", "0"));
            // Act
            var  runner      = new CustomActionRunner(mockHelper.Object);
            bool isInstalled = runner.IsLavFiltersAlreadyInstalled();

            // Assert
            Assert.Equal(isInstalled, false);
        }
Exemple #6
0
 public void NullStorage()
 {
     CustomActionRunner.ValidateStorage(null, StorageDir);
 }
Exemple #7
0
 public void EmptyStorageDir()
 {
     CustomActionRunner.ValidateStorage("3.14", "");
 }
Exemple #8
0
 public void EmptyBandwidth()
 {
     CustomActionRunner.ValidateBandwidth("");
 }
Exemple #9
0
 public void PrefixMissing()
 {
     CustomActionRunner.ValidateWallet("e857955cfCd98bAe1073d4e314c3F9526799357A");
 }
Exemple #10
0
 public void NullWallet()
 {
     CustomActionRunner.ValidateWallet(null);
 }
 public void EmptyIdentityDir()
 {
     CustomActionRunner.ValidateIdentityDir("");
 }
Exemple #12
0
 public void InvalidNumber()
 {
     CustomActionRunner.ValidateBandwidth("some random text");
 }
Exemple #13
0
 public void ValidServiceCmd()
 {
     Assert.AreEqual("C:\\Program Files\\Storj\\Storage Node\\\\",
                     CustomActionRunner.ExtractInstallDir("\"C:\\Program Files\\Storj\\Storage Node\\storagenode.exe\" run  --config-dir \"C:\\Program Files\\Storj\\Storage Node\\\\\""));
 }
Exemple #14
0
 public void MissingConfigDirFlag()
 {
     Assert.IsNull(CustomActionRunner.ExtractInstallDir("\"C:\\Program Files\\Storj\\Storage Node\\storagenode.exe\" run"));
 }
Exemple #15
0
 public void EmptyServiceCmd()
 {
     Assert.IsNull(CustomActionRunner.ExtractInstallDir(""));
 }
Exemple #16
0
 public void NullServiceCmd()
 {
     Assert.IsNull(CustomActionRunner.ExtractInstallDir(null));
 }
Exemple #17
0
 public void ValidBandwidth()
 {
     CustomActionRunner.ValidateBandwidth("3.14");
 }
Exemple #18
0
 public void TooSmall()
 {
     CustomActionRunner.ValidateBandwidth("1.41");
 }
Exemple #19
0
 public void EmptyStorage()
 {
     CustomActionRunner.ValidateStorage("", StorageDir);
 }
Exemple #20
0
 public void InvalidNumber()
 {
     CustomActionRunner.ValidateStorage("some random text", StorageDir);
 }
 public void NullIdentityDir()
 {
     CustomActionRunner.ValidateIdentityDir(null);
 }
Exemple #22
0
 public void TooSmall()
 {
     CustomActionRunner.ValidateStorage("0.41", StorageDir);
 }
 public void NonexistentIdentityDir()
 {
     CustomActionRunner.ValidateIdentityDir("X:\\Some\\Nonexistent\\Folder");
 }
Exemple #24
0
 public void TooLarge()
 {
     CustomActionRunner.ValidateStorage("10000000", StorageDir);
 }
Exemple #25
0
 public void EmptyWallet()
 {
     CustomActionRunner.ValidateWallet("");
 }
Exemple #26
0
 public void NullStorageDir()
 {
     CustomActionRunner.ValidateStorage("3.14", null);
 }
Exemple #27
0
 public void ValidWallet()
 {
     CustomActionRunner.ValidateWallet("0xe857955cfCd98bAe1073d4e314c3F9526799357A");
 }
Exemple #28
0
 public void NullBandwidth()
 {
     CustomActionRunner.ValidateBandwidth(null);
 }