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); }
public void OverallChangeTypeReturnsHighestResult(SemVerChangeType firstType, SemVerChangeType secondType, SemVerChangeType expected) { var firstItem = new TestPropertyDefinition(); var secondItem = new TestPropertyDefinition(); var match = new ItemMatch <IPropertyDefinition>(firstItem, secondItem); var firstResult = new ComparisonResult(firstType, match.OldItem, match.NewItem, Guid.NewGuid().ToString()); var secondResult = new ComparisonResult(secondType, match.OldItem, match.NewItem, Guid.NewGuid().ToString()); var sut = new ChangeResultAggregator(); sut.AddResult(firstResult); sut.AddResult(secondResult); var actual = sut.OverallChangeType; actual.Should().Be(expected); }