Example #1
0
        public void InstallOrUpgrade_ShouldFailWhenNotStaged()
        {
            var finder = CreateProductsFinderWithChefInstalled();
            var fakeProductInstaller = new FakeProductInstaller(finder);

            fakeProductInstaller.IsStagedValue = false;
            var product = CreateChefProduct(finder, fakeProductInstaller);

            var result = product.InstallOrUpgrade("15.1.2", new FakeMessagePresenter());

            result.IsFailed.Should().BeTrue("because the product isn't staged");
        }
Example #2
0
        public void InstallOrUpgrade_ShouldUninstallExistingProductThenInstallNewOne()
        {
            var chefInstallationMetaData = CreateProductInstallationMetaData("1.2.3");
            var finder    = new FakeInstalledProductsFinder(chefInstallationMetaData);
            var installer = new FakeProductInstaller(finder);

            var product = new ChefProduct("chef", finder, installer, InstalledProductsFinder.IsChefClient);

            const string versionInstalled = "15.1.2";

            product.InstallOrUpgrade(versionInstalled, new FakeMessagePresenter());

            installer.ProductCodeUninstalled.Should()
            .Be(chefInstallationMetaData.Parent,
                "because since the product is already installed, we should uninstall it");
            installer.VersionInstalled.Should().Be(versionInstalled);
        }
Example #3
0
 private static ChefProduct CreateChefProduct(FakeInstalledProductsFinder finder, FakeProductInstaller fakeProductInstaller)
 {
     return(new ChefProduct("chef", finder, fakeProductInstaller, InstalledProductsFinder.IsChefClient));
 }
Example #4
0
        private ChefProduct CreateChefProduct(FakeInstalledProductsFinder finder)
        {
            var fakeProductInstaller = new FakeProductInstaller(finder);

            return(CreateChefProduct(finder, fakeProductInstaller));
        }