public void Return_empty_display_list_when_build_type_ids_is_empty()
        {
            _build.GetBuilds().Returns(new List <Build>());

            var displayList = new BuildStabilityViewModel(_build, _tellTheTime).GetBuildGroupList();

            Assert.That(displayList.Count, Is.EqualTo(0));
        }
        public List <BuildStabilityMetric> CalculateBuildStability(BuildFilter buildFilter, IBuildMetric buildMetric)
        {
            var builds = _build.GetBuilds();

            var buildMetrics = (BuildStabilityMetric)Calculate(builds, buildFilter, buildMetric);

            return(buildMetrics
                   .GetResults()
                   .OrderBy(result => result.Date)
                   .ToList());
        }
        public void Return_all_failing_builds()
        {
            var builds = new List <Build>
            {
                new Build
                {
                    Id             = 1,
                    BuildTypeId    = "passing build type id",
                    StartDateTime  = new DateTime(2017, 11, 1, 12, 0, 0),
                    FinishDateTime = new DateTime(2017, 11, 1, 12, 0, 30),
                    Status         = "Success",
                    State          = "Finished"
                },
                new Build
                {
                    Id             = 2,
                    BuildTypeId    = "passing build type id",
                    StartDateTime  = new DateTime(2017, 11, 1, 12, 1, 0),
                    FinishDateTime = new DateTime(2017, 11, 1, 12, 1, 30),
                    Status         = "Success",
                    State          = "Finished"
                }
            };

            builds.AddRange(GetBuilds("failing build type id"));

            _build.GetBuilds().Returns(builds);

            var failingBuilds = new BuildStability(_tellTheTime, _build).GetFailingBuildsByRate();

            Assert.That(failingBuilds.All(b => b.BuildTypeId.Equals("failing build type id")));
        }
Ejemplo n.º 4
0
        public List <BuildGroup> GetDistinctBuildGroups()
        {
            var results = new List <BuildGroup>();

            foreach (var buildGroup in _build.GetBuilds()
                     .Select(b => new BuildGroup(b.BuildTypeId)))
            {
                if (!results.Exists(b => b.BuildTypeGroup.Equals(buildGroup.BuildTypeGroup)))
                {
                    results.Add(buildGroup);
                }
            }

            return(results.OrderBy(b => b.BuildTypeGroup).ToList());
        }
        public void Setup()
        {
            var builds = GetBuildDataFrom(new DateTime(2017, 01, 01), 300);

            _build       = Substitute.For <IBuild>();
            _tellTheTime = Substitute.For <ITellTheTime>();

            _build.GetBuilds().Returns(builds);
            _build.GetSuccessfulBuildStepsContaining(Arg.Any <string>()).Returns(
                builds
                .Where(b =>
                       b.BuildTypeId.Contains("_01") &&
                       b.Status.Equals(BuildStatus.Success.ToString()) &&
                       b.State.Equals("Finished", StringComparison.InvariantCultureIgnoreCase))
                .ToList());

            _tellTheTime.Today().Returns(new DateTime(2017, 11, 27));
            _tellTheTime.Now().Returns(new DateTime(2017, 11, 27));

            _buildThroughput = new BuildThroughput(_build, _tellTheTime);
        }
 public List <BuildFailureRate> GetFailingBuildsByRate()
 {
     return(new BuildStabilityMetric().GetFailingBuildsByRate(_build.GetBuilds()));
 }