GetBuilds() public method

public GetBuilds ( Action having, Action count, Action include ) : IList
having Action
count Action
include Action
return IList
        public void GetBuilds_ByBuildConfigurationTake5DefaultColumns_GetFotmatCalled()
        {
            // Arrange
            var teamCityCaller = A.Fake<ITeamCityCaller>();
            A.CallTo(
                () =>
                    teamCityCaller.GetFormat<BuildWrapper>(
                        "/app/rest/builds?locator={0},{1},&fields=count,build({2})",
                        A<object[]>._))
                .Returns(new BuildWrapper {Count = "0"});

            var buildHavingBuilder = A.Fake<BuildHavingBuilder>();
            A.CallTo(() => buildHavingBuilder.GetLocator()).Returns("buildType:name:FluentTc");

            var buildHavingBuilderFactory = A.Fake<IBuildHavingBuilderFactory>();
            A.CallTo(() => buildHavingBuilderFactory.CreateBuildHavingBuilder()).Returns(buildHavingBuilder);

            var countBuilder = A.Fake<CountBuilder>();
            A.CallTo(() => countBuilder.GetCount()).Returns("count:5");

            var countBuilderFactory = A.Fake<ICountBuilderFactory>();
            A.CallTo(() => countBuilderFactory.CreateCountBuilder()).Returns(countBuilder);

            var buildIncludeBuilder = A.Fake<BuildIncludeBuilder>();
            A.CallTo(() => buildIncludeBuilder.GetColumns()).Returns("buildTypeId,href,id,number,state,status,webUrl");

            var buildIncludeBuilderFactory = A.Fake<IBuildIncludeBuilderFactory>();
            A.CallTo(() => buildIncludeBuilderFactory.CreateBuildIncludeBuilder()).Returns(buildIncludeBuilder);

            var buildsRetriever = new BuildsRetriever(teamCityCaller, buildHavingBuilderFactory, countBuilderFactory,
                buildIncludeBuilderFactory, A.Fake<IQueueHavingBuilderFactory>(), A.Fake<IBuildModelToBuildConverter>());

            // Act
            var builds = buildsRetriever.GetBuilds(_ => _.BuildConfiguration(b => b.Name("FluentTc")), _ => _.Count(5),
                _ => _.IncludeDefaults());

            // Assert
            A.CallTo(
                () =>
                    teamCityCaller.GetFormat<BuildWrapper>(
                        "/app/rest/builds?locator={0},{1},&fields=count,build({2})",
                        A<object[]>.That.IsSameSequenceAs(new object[]
                        {"buildType:name:FluentTc", "count:5", "buildTypeId,href,id,number,state,status,webUrl"})))
                .MustHaveHappened(Repeated.Exactly.Once);
        }
        public void GetBuilds_ByIdAllDefaultColumns_GeFotmatCalled()
        {
            // Arrange
            var teamCityCaller = A.Fake<ITeamCityCaller>();
            A.CallTo(
                () =>
                    teamCityCaller.GetFormat<BuildWrapper>(
                        "/app/rest/builds?locator={0},&fields=count,build({1})",
                        A<object[]>._))
                .Returns(new BuildWrapper() {Count = "0"});

            var buildHavingBuilder = A.Fake<BuildHavingBuilder>();
            A.CallTo(() => buildHavingBuilder.GetLocator()).Returns("id:123");

            var buildHavingBuilderFactory = A.Fake<IBuildHavingBuilderFactory>();
            A.CallTo(() => buildHavingBuilderFactory.CreateBuildHavingBuilder()).Returns(buildHavingBuilder);

            var countBuilder = A.Fake<CountBuilder>();
            A.CallTo(() => countBuilder.GetCount()).Returns(string.Empty);

            var countBuilderFactory = A.Fake<ICountBuilderFactory>();
            A.CallTo(() => countBuilderFactory.CreateCountBuilder()).Returns(countBuilder);

            var buildIncludeBuilder = A.Fake<BuildIncludeBuilder>();
            A.CallTo(() => buildIncludeBuilder.GetColumns()).Returns("buildTypeId,href,id,number,state,status,webUrl");

            var buildIncludeBuilderFactory = A.Fake<IBuildIncludeBuilderFactory>();
            A.CallTo(() => buildIncludeBuilderFactory.CreateBuildIncludeBuilder()).Returns(buildIncludeBuilder);

            var buildsRetriever = new BuildsRetriever(teamCityCaller, buildHavingBuilderFactory, countBuilderFactory, buildIncludeBuilderFactory,A.Fake<IQueueHavingBuilderFactory>());

            // Act
            var builds = buildsRetriever.GetBuilds(_ => _.Id(123), _ => _.DefaultCount(), _ => _.IncludeDefaults());

            // Assert
            A.CallTo(
                () =>
                    teamCityCaller.GetFormat<BuildWrapper>(
                        "/app/rest/builds?locator={0},&fields=count,build({1})",
                        A<object[]>.That.IsSameSequenceAs(new object[] { "id:123", "buildTypeId,href,id,number,state,status,webUrl" })))
                .MustHaveHappened(Repeated.Exactly.Once);
        }