public List <BuildThroughputMetric> CalculateBuildThroughput(BuildFilter buildFilter, IBuildMetric buildMetric)
        {
            var builds = _build.GetSuccessfulBuildStepsContaining("_01");

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

            return(buildMetrics
                   .GetResults()
                   .OrderBy(result => result.Date)
                   .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);
        }