Esempio n. 1
0
        public void FindMatchesIdentifiesPropertiesNotMatching()
        {
            var oldProperty         = new TestPropertyDefinition();
            var newProperty         = new TestPropertyDefinition();
            var oldMatchingProperty = new TestPropertyDefinition();
            var oldProperties       = new[]
            {
                oldProperty, oldMatchingProperty
            };
            var newMatchingProperty = oldMatchingProperty.JsonClone();
            var newProperties       = new[]
            {
                newMatchingProperty, newProperty
            };

            var sut = new PropertyEvaluator();

            var results = sut.FindMatches(oldProperties, newProperties);

            results.MatchingItems.Should().HaveCount(1);
            results.MatchingItems.First().OldItem.Should().Be(oldMatchingProperty);
            results.MatchingItems.First().NewItem.Should().Be(newMatchingProperty);
            results.ItemsAdded.Should().HaveCount(1);
            results.ItemsAdded.First().Should().Be(newProperty);
            results.ItemsRemoved.Should().HaveCount(1);
            results.ItemsRemoved.First().Should().Be(oldProperty);
        }
Esempio n. 2
0
        public void FindMatchesReturnsSinglePropertyMatchingByName()
        {
            var oldProperty   = new TestPropertyDefinition();
            var oldProperties = new[]
            {
                oldProperty
            };
            var newProperty   = oldProperty.JsonClone();
            var newProperties = new[]
            {
                newProperty
            };

            var sut = new PropertyEvaluator();

            var results = sut.FindMatches(oldProperties, newProperties);

            results.MatchingItems.Should().HaveCount(1);
            results.MatchingItems.First().OldItem.Should().Be(oldProperty);
            results.MatchingItems.First().NewItem.Should().Be(newProperty);
            results.ItemsAdded.Should().BeEmpty();
            results.ItemsRemoved.Should().BeEmpty();
        }