Пример #1
0
        public void GetLastBuild_BuildConfigurationStatus_BuildWithWithAllDetails()
        {
            // Arrange
            var teamCityCaller = CreateTeamCityCaller();

            A.CallTo(
                () =>
                teamCityCaller.Get <BuildWrapper>(
                    "/app/rest/builds?locator=buildType:id:bt2,status:SUCCESS,count:1,&fields=count,build(buildTypeId,href,id,number,state,status,webUrl)"))
            .Returns(new BuildWrapper {
                Count = "1", Build = new List <BuildModel>(new[] { new BuildModel {
                                                                       Id = 987, Status = "FAILURE"
                                                                   } })
            });
            A.CallTo(() => teamCityCaller.Get <BuildModel>("/app/rest/builds/id:987"))
            .Returns(new BuildModel {
                Id = 987, Status = "SUCCESS"
            });

            var connectedTc = new RemoteTc().Connect(_ => _.AsGuest(), teamCityCaller);

            // Act
            var build =
                connectedTc.GetLastBuild(_ => _.BuildConfiguration(__ => __.Id("bt2")).Status(BuildStatus.Success));

            // Assert
            build.Id.Should().Be(987);
            build.Status.Should().Be(BuildStatus.Success);
        }