示例#1
0
        public void CountFive()
        {
            // Arrange
            var countBuilder = new CountBuilder();

            // Act
            var builder = countBuilder.Count(5);

            builder.GetCount().Should().Be("count:5");
        }
示例#2
0
        public void StartTwoCountFive()
        {
            // Arrange
            var countBuilder = new CountBuilder();

            // Act
            var builder = countBuilder.Start(2).Count(5);

            builder.GetCount().Should().Be("start:2,count:5");
        }
示例#3
0
        public void All()
        {
            // Arrange
            var countBuilder = new CountBuilder();

            // Act
            var builder = countBuilder.All();

            builder.GetCount().Should().Be("count:-1");
        }
示例#4
0
        private BuildWrapper GetBuildWrapper(BuildHavingBuilder buildHavingBuilder, CountBuilder countBuilder,
            BuildIncludeBuilder buildIncludeBuilder)
        {
            var locator = buildHavingBuilder.GetLocator();
            var count = countBuilder.GetCount();
            var columns = buildIncludeBuilder.GetColumns();

            if (string.IsNullOrEmpty(count))
            {
                return m_Caller.GetFormat<BuildWrapper>("/app/rest/builds?locator={0},&fields=count,build({1})", locator,
                    columns);
            }

            return m_Caller.GetFormat<BuildWrapper>("/app/rest/builds?locator={0},{1},&fields=count,build({2})",
                locator, count, columns);
        }
示例#5
0
        public List<Build> GetBuilds(Action<IBuildHavingBuilder> having, Action<CountBuilder> count, Action<BuildIncludeBuilder> include)
        {
            var buildHavingBuilder = m_BuildHavingBuilderFactory.CreateBuildHavingBuilder();
            having(buildHavingBuilder);
            var buildIncludeBuilder = new BuildIncludeBuilder();
            include(buildIncludeBuilder);
            var countBuilder = new CountBuilder();
            count(countBuilder);

            var locator = buildHavingBuilder.GetLocator();
            var parts = countBuilder.GetCount();
            var columns = buildIncludeBuilder.GetColumns();
            var buildWrapper = m_Caller.GetFormat<BuildWrapper>("/app/rest/builds?locator={0},count:{1},&fields=count,build({2})",
                locator, parts, columns);
            if (int.Parse(buildWrapper.Count) > 0)
            {
                return buildWrapper.Build;
            }
            return new List<Build>();
        }