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

            releaseClient.GetApprovals(Arg.Any <int>(), Arg.Any <string>())
            .Returns(new List <ReleaseApproval>
            {
                new ReleaseApproval {
                    Id = 123
                }
            });

            authenticator.Authenticate().Returns(new AuthenticationResult()
            {
                Success = true
            });

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

            this.sut.UpdateApproval("123");

            releaseClient.ReceivedWithAnyArgs(1).UpdateApproval(Arg.Any <int>(), Arg.Any <string>());
        }
Example #2
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);
        }