Exemple #1
0
        public void GetReleaseEnvironmentStatus_ReleaseInProgress_ChecksForApprovals()
        {
            IVstsReleaseClient releaseClient = Substitute.For <IVstsReleaseClient>();
            IAuthenticator     authenticator = Substitute.For <IAuthenticator>();
            VstsConfig         vstsConfig    = new VstsConfig();

            authenticator.Authenticate().Returns(new AuthenticationResult {
                Success = true
            });
            releaseClient.GetRelease(Arg.Any <int>(), Arg.Any <string>()).Returns(GetTestRelease(EnvironmentStatus.InProgress));

            this.sut = new VstsReleaseRepository(releaseClient, authenticator, vstsConfig);

            SolutionDeploy.Core.DeploymentStatus result = this.sut.GetReleaseEnvironmentStatus("123", "123");

            releaseClient.ReceivedWithAnyArgs().GetApprovals(default(int), default(string));
        }
Exemple #2
0
        public void GetReleaseEnvironmentStatus_DoesntGetRelease_ReturnsUnknown()
        {
            IVstsReleaseClient releaseClient = Substitute.For <IVstsReleaseClient>();
            IAuthenticator     authenticator = Substitute.For <IAuthenticator>();
            VstsConfig         vstsConfig    = new VstsConfig();

            authenticator.Authenticate().Returns(new AuthenticationResult {
                Success = true
            });
            releaseClient.GetRelease(Arg.Any <int>(), Arg.Any <string>()).Returns((Release)null);

            this.sut = new VstsReleaseRepository(releaseClient, authenticator, vstsConfig);

            SolutionDeploy.Core.DeploymentStatus result = this.sut.GetReleaseEnvironmentStatus("123", "999");

            Assert.Equal(SolutionDeploy.Core.DeploymentStatus.Unknown, result);
        }
Exemple #3
0
        public void GetReleaseEnvironmentStatus_ReleaseHasNoApprovals_ReturnsInProgress()
        {
            IVstsReleaseClient releaseClient = Substitute.For <IVstsReleaseClient>();
            IAuthenticator     authenticator = Substitute.For <IAuthenticator>();
            VstsConfig         vstsConfig    = new VstsConfig();

            authenticator.Authenticate().Returns(new AuthenticationResult {
                Success = true
            });
            releaseClient.GetRelease(Arg.Any <int>(), Arg.Any <string>()).Returns(GetTestRelease(EnvironmentStatus.InProgress));
            releaseClient.GetApprovals(Arg.Any <int>(), Arg.Any <string>()).Returns(new List <ReleaseApproval>());

            this.sut = new VstsReleaseRepository(releaseClient, authenticator, vstsConfig);

            SolutionDeploy.Core.DeploymentStatus result = this.sut.GetReleaseEnvironmentStatus("123", "123");

            Assert.Equal(SolutionDeploy.Core.DeploymentStatus.InProgress, result);
        }
Exemple #4
0
        internal void GetReleaseEnvironmentStatus_GetsEnvironment_ReturnsStatus(
            EnvironmentStatus envStatus,
            SolutionDeploy.Core.DeploymentStatus deployStatus)
        {
            IVstsReleaseClient releaseClient = Substitute.For <IVstsReleaseClient>();
            IAuthenticator     authenticator = Substitute.For <IAuthenticator>();
            VstsConfig         vstsConfig    = new VstsConfig();

            authenticator.Authenticate().Returns(new AuthenticationResult {
                Success = true
            });
            releaseClient.GetRelease(Arg.Any <int>(), Arg.Any <string>())
            .Returns(this.GetTestRelease(envStatus));

            this.sut = new VstsReleaseRepository(releaseClient, authenticator, vstsConfig);

            SolutionDeploy.Core.DeploymentStatus result = this.sut.GetReleaseEnvironmentStatus("123", "123");

            Assert.Equal(deployStatus, result);
        }