public void FailsWithDefaultConfiguration()
        {
            MockLocalScalarConfig scalarConfig = this.ConstructDefaultConfigBuilder()
                                                 .Build();

            bool success = ProductUpgrader.TryCreateUpgrader(
                this.tracer,
                this.fileSystemMock.Object,
                scalarConfig,
                this.credentialStoreMock.Object,
                false,
                false,
                out ProductUpgrader productUpgrader,
                out string error);

            success.ShouldBeFalse();
            productUpgrader.ShouldBeNull();
            error.ShouldNotBeNull();
        }
Ejemplo n.º 2
0
        public virtual void Setup()
        {
            this.Tracer        = new MockTracer();
            this.FileSystem    = new MockFileSystem(new MockDirectory(@"mock:\Scalar.Upgrades\Download", null, null));
            this.Output        = new MockTextWriter();
            this.PrerunChecker = new MockInstallerPrerunChecker(this.Tracer);
            this.LocalConfig   = new MockLocalScalarConfig();

            this.Upgrader = new MockGitHubUpgrader(
                LocalScalarVersion,
                this.Tracer,
                this.FileSystem,
                new GitHubUpgrader.GitHubUpgraderConfig(this.Tracer, this.LocalConfig));

            this.PrerunChecker.Reset();
            this.Upgrader.PretendNewReleaseAvailableAtRemote(
                upgradeVersion: NewerThanLocalVersion,
                remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow);
            this.SetUpgradeRing("Slow");
        }
Ejemplo n.º 3
0
        public void CreatesGitHubUpgraderWhenConfigured()
        {
            MockLocalScalarConfig scalarConfig = this.ConstructDefaultGitHubConfigBuilder()
                                                 .Build();

            bool success = ProductUpgrader.TryCreateUpgrader(
                this.tracer,
                this.fileSystemMock.Object,
                scalarConfig,
                this.credentialStoreMock.Object,
                false,
                false,
                out ProductUpgrader productUpgrader,
                out string error);

            success.ShouldBeTrue();
            productUpgrader.ShouldNotBeNull();
            productUpgrader.ShouldBeOfType <GitHubUpgrader>();
            error.ShouldBeNull();
        }
Ejemplo n.º 4
0
        public void NoUpgraderWhenNuGetPackNameMissing()
        {
            MockLocalScalarConfig scalarConfig = this.ConstructDefaultMockNuGetConfigBuilder()
                                                 .WithNoUpgradeFeedPackageName()
                                                 .Build();

            bool success = ProductUpgrader.TryCreateUpgrader(
                this.tracer,
                this.fileSystemMock.Object,
                scalarConfig,
                this.credentialStoreMock.Object,
                false,
                false,
                out ProductUpgrader productUpgrader,
                out string error);

            success.ShouldBeFalse();
            productUpgrader.ShouldBeNull();
            error.ShouldNotBeNull();
        }