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_When_Project_Has_Multiple_Releases_With_Success_Deployments_Returns_Correct_Count() { // Arrange var project = new Project() { releases = new List <Release>() { new Release() { deployments = new List <Deployment>() { new Deployment() { state = "Success" } } }, new Release() { deployments = new List <Deployment>() { new Deployment() { state = "Success" } } } } }; _projects.Add(project); // Act var result = _calculator.Calculate(_projects); // Assert Assert.AreEqual(2, result); }