public void MergeResultsCopiesAcrossResultsFromAggregator() { var childResults = new List <ComparisonResult> { new(SemVerChangeType.Feature, null, new TestClassDefinition(), Guid.NewGuid().ToString()), new(SemVerChangeType.Breaking, new TestInterfaceDefinition(), null, Guid.NewGuid().ToString()), new( SemVerChangeType.Feature, new TestPropertyDefinition(), new TestPropertyDefinition(), Guid.NewGuid().ToString()), new( SemVerChangeType.Breaking, new TestFieldDefinition(), new TestFieldDefinition(), Guid.NewGuid().ToString()), }; var aggregator = new ChangeResultAggregator { ExitNodeAnalysis = true }; aggregator.AddResults(childResults); var sut = new ChangeResultAggregator(); sut.MergeResults(aggregator); var actual = sut.Results; actual.Should().BeEquivalentTo(childResults); sut.ExitNodeAnalysis.Should().Be(aggregator.ExitNodeAnalysis); }
public void ResultsReturnsAddedResults() { var first = new ComparisonResult(SemVerChangeType.Feature, null, new TestPropertyDefinition(), Guid.NewGuid().ToString()); var second = new ComparisonResult(SemVerChangeType.Breaking, new TestFieldDefinition(), null, Guid.NewGuid().ToString()); var set = new List <ComparisonResult> { new(SemVerChangeType.Feature, null, new TestClassDefinition(), Guid.NewGuid().ToString()), new(SemVerChangeType.Breaking, new TestInterfaceDefinition(), null, Guid.NewGuid().ToString()), new( SemVerChangeType.Feature, new TestPropertyDefinition(), new TestPropertyDefinition(), Guid.NewGuid().ToString()), new( SemVerChangeType.Breaking, new TestAttributeDefinition(), new TestAttributeDefinition(), Guid.NewGuid().ToString()), }; var expected = new List <ComparisonResult> { first }; expected.AddRange(set); expected.Add(second); var sut = new ChangeResultAggregator(); sut.AddResult(first); sut.AddResults(set); sut.AddResult(second); var actual = sut.Results; actual.Should().BeEquivalentTo(expected); }