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

            authenticator.Authenticate().Returns(new AuthenticationResult {
                Success = true
            });
            releaseClient.GetReleaseDefinitions(Arg.Any <string>(), Arg.Any <string>()).Returns(GetTestReleaseDefinitions());
            releaseClient.GetBuilds(Arg.Any <int>(), Arg.Any <string>(), Arg.Any <string>()).Returns(GetTestBuilds());

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

            string result = this.sut.GetReleaseId("someService", version: "someVersion");

            Assert.Null(result);
        }
Beispiel #2
0
        public void GetReleaseId_GetsBuilds_GetsReleases()
        {
            IVstsReleaseClient releaseClient = Substitute.For <IVstsReleaseClient>();
            IAuthenticator     authenticator = Substitute.For <IAuthenticator>();
            VstsConfig         vstsConfig    = new VstsConfig();

            authenticator.Authenticate().Returns(new AuthenticationResult {
                Success = true
            });
            releaseClient.GetReleaseDefinitions(Arg.Any <string>(), Arg.Any <string>()).Returns(GetTestReleaseDefinitions());
            releaseClient.GetBuilds(Arg.Any <int>(), Arg.Any <string>(), Arg.Any <string>()).Returns(GetTestBuilds());

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

            this.sut.GetReleaseId("someService", version: "someVersion");

            releaseClient.ReceivedWithAnyArgs().GetReleases(default(int), default(string), default(int));
        }