public AnalysisResult Analyze(string previousAssembly, string currentAssembly, string proposedVersionNumber) { var differ = new DiffAssemblies(); var previous = new FileQuery(previousAssembly); var current = new FileQuery(currentAssembly); var differences = differ.Execute(new List<FileQuery> { previous }, new List<FileQuery> { current }); var rule = new BreakingChangeRule(); var breakingChange = rule.Detect(differences); if (breakingChange) { var semVer = SemVersion.Parse(proposedVersionNumber); var decidedVersionNumber = semVer.Change(semVer.Major + 1, 0, 0); proposedVersionNumber = decidedVersionNumber.ToString(); } return new AnalysisResult { BreakingChangesDetected = breakingChange, VersionNumber = proposedVersionNumber }; }
public void WhenICompareTheTwoAssembliesAndValidateTheRules() { var differ = new DiffAssemblies(); var previous = new FileQuery(ScenarioContext.Current.Get<string>("PreviousAssembly")); var newAssembly = new FileQuery(ScenarioContext.Current.Get<string>("NewAssembly")); var differences = differ.Execute(new List<FileQuery> { previous }, new List<FileQuery> { newAssembly }); var rule = new BreakingChangeRule(); var result = rule.Detect(differences); ScenarioContext.Current.Set(result, "Results"); }