コード例 #1
0
        public void GetSingleSuccessfulFinishedBuild()
        {
            // Arrange
            var teamCityCaller = CreateTeamCityCaller();

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

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

            // Act
            var builds = connectedTc.GetBuilds(which => which
                                               .BuildConfiguration(b => b.Id("FluentTc"))
                                               .NotRunning()
                                               .Status(BuildStatus.Success),
                                               with => with.IncludeFinishDate()
                                               .IncludeStartDate(),
                                               count => count.Count(1));

            // Assert
            builds.Single().Id.Should().Be(123);
        }
コード例 #2
0
        public void GetBuilds_BuildConfigurationName()
        {
            // Arrange
            var teamCityCaller = CreateTeamCityCaller();
            var build          = new BuildModel {
                Id = 987, Status = "SUCCESS"
            };

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

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

            // Act
            var builds = connectedTc.GetBuilds(_ => _.BuildConfiguration(__ => __.Name("FluentTc")));

            // Assert
            builds.Single().Id.Should().Be(987);
        }
コード例 #3
0
        public void GetBuilds_SinceDate()
        {
            // Arrange
            var teamCityCaller = CreateTeamCityCaller();
            var build          = new BuildModel {
                Id = 987
            };

            A.CallTo(
                () =>
                teamCityCaller.Get <BuildWrapper>(
                    "/app/rest/builds?locator=sinceDate:20151026T142200%2b0000,&fields=count,build(buildTypeId,href,id,number,state,status,webUrl)"))
            .Returns(new BuildWrapper {
                Count = "1", Build = new List <BuildModel>(new[] { build })
            });

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

            // Act
            var builds = connectedTc.GetBuilds(_ => _.SinceDate(new DateTime(2015, 10, 26, 16, 22, 0)));

            // Assert
            builds.ShouldAllBeEquivalentTo(new [] { build });
        }
コード例 #4
0
ファイル: AcceptanceTests.cs プロジェクト: TCDooM/FluentTc
        public void GetBuilds_SinceDate()
        {
            // Arrange
            var teamCityCaller = CreateTeamCityCaller();
            var build = new Build {Id = 987};

            A.CallTo(
                () =>
                    teamCityCaller.Get<BuildWrapper>(
                        "/app/rest/builds?locator=sinceDate:20151026T142200%2b0000,&fields=count,build(buildTypeId,href,id,number,state,status,webUrl)"))
                .Returns(new BuildWrapper {Count = "1", Build = new List<Build>(new[] {build})});

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

            // Act
            var builds = connectedTc.GetBuilds(_ => _.SinceDate(new DateTime(2015,10,26,16,22,0)));

            // Assert
            builds.ShouldAllBeEquivalentTo(new [] { build });
        }
コード例 #5
0
ファイル: AcceptanceTests.cs プロジェクト: TCDooM/FluentTc
        public void GetBuilds_BuildConfigurationName()
        {
            // Arrange
            var teamCityCaller = CreateTeamCityCaller();
            var build = new Build {Id = 987};

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

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

            // Act
            var builds = connectedTc.GetBuilds(_ => _.BuildConfiguration(__ => __.Name("FluentTc")));

            // Assert
            builds.ShouldAllBeEquivalentTo(new [] { build });
        }