public AnalysisInfo AnalyseDataset(string filename) { // Serialise JSON file to objects var projects = _loader.LoadFromFile(filename); // Call calculator classes to get metrics var noofsuccessdeployments = _noofsuccessdeploymentscalc.Calculate(projects.projects); var successbreakdown = _successDeploymentBreakdownCalc.Calculate(projects.projects); var mostpopularliveday = _mostpopulardayforlivecalc.Calculate(projects.projects); var inttoliveaverage = _integrationtolivecalc.Calculate(projects.projects); var pipelinebreakdown = _pipelinebreakdowncalc.Calculate(projects.projects); // Compose results into Analysis DTO to be returned var results = new AnalysisInfo() { TotalNoOfSuccessfulDeployments = noofsuccessdeployments, SuccessfulDeploymentBreakdown = successbreakdown, MostPopularLiveDeploymentWeekday = mostpopularliveday, IntegrationToLiveBreakdowns = inttoliveaverage, PipelineBreakdowns = pipelinebreakdown }; return(results); }
public void Calculate_Includes_All_Live_Deployments() { // Arrange var project = Datasetup.AddProject(_projects); var release = Datasetup.AddRelease(project); Datasetup.AddDeployment(release, environment: "Live", created: _dtNow); Datasetup.AddDeployment(release, environment: "Live", created: _dtWeekAgo); Datasetup.AddDeployment(release, environment: "Live", created: _dt11DaysAgo); // Act var result = _calculator.Calculate(_projects); // Assert Assert.AreEqual(_dtNow.DayOfWeek, result); }