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); }
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); }
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); }
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); }
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); }
public void NullStorage() { CustomActionRunner.ValidateStorage(null, StorageDir); }
public void EmptyStorageDir() { CustomActionRunner.ValidateStorage("3.14", ""); }
public void EmptyBandwidth() { CustomActionRunner.ValidateBandwidth(""); }
public void PrefixMissing() { CustomActionRunner.ValidateWallet("e857955cfCd98bAe1073d4e314c3F9526799357A"); }
public void NullWallet() { CustomActionRunner.ValidateWallet(null); }
public void EmptyIdentityDir() { CustomActionRunner.ValidateIdentityDir(""); }
public void InvalidNumber() { CustomActionRunner.ValidateBandwidth("some random text"); }
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\\\\\"")); }
public void MissingConfigDirFlag() { Assert.IsNull(CustomActionRunner.ExtractInstallDir("\"C:\\Program Files\\Storj\\Storage Node\\storagenode.exe\" run")); }
public void EmptyServiceCmd() { Assert.IsNull(CustomActionRunner.ExtractInstallDir("")); }
public void NullServiceCmd() { Assert.IsNull(CustomActionRunner.ExtractInstallDir(null)); }
public void ValidBandwidth() { CustomActionRunner.ValidateBandwidth("3.14"); }
public void TooSmall() { CustomActionRunner.ValidateBandwidth("1.41"); }
public void EmptyStorage() { CustomActionRunner.ValidateStorage("", StorageDir); }
public void InvalidNumber() { CustomActionRunner.ValidateStorage("some random text", StorageDir); }
public void NullIdentityDir() { CustomActionRunner.ValidateIdentityDir(null); }
public void TooSmall() { CustomActionRunner.ValidateStorage("0.41", StorageDir); }
public void NonexistentIdentityDir() { CustomActionRunner.ValidateIdentityDir("X:\\Some\\Nonexistent\\Folder"); }
public void TooLarge() { CustomActionRunner.ValidateStorage("10000000", StorageDir); }
public void EmptyWallet() { CustomActionRunner.ValidateWallet(""); }
public void NullStorageDir() { CustomActionRunner.ValidateStorage("3.14", null); }
public void ValidWallet() { CustomActionRunner.ValidateWallet("0xe857955cfCd98bAe1073d4e314c3F9526799357A"); }
public void NullBandwidth() { CustomActionRunner.ValidateBandwidth(null); }