コード例 #1
0
        public void CompareMatchReturnsEmptyWhenNoChangesFound()
        {
            var oldItem = new TestParameterDefinition();
            var newItem = oldItem.JsonClone();
            var match   = new ItemMatch <IParameterDefinition>(oldItem, newItem);
            var options = ComparerOptions.Default;

            var actual = SUT.CompareMatch(match, options).ToList();

            _output.WriteResults(actual);

            actual.Should().BeEmpty();
        }
コード例 #2
0
        public void CompareMatchReturnsBreakingWhenTypeChanged()
        {
            var oldItem = new TestParameterDefinition();
            var newItem = oldItem.JsonClone().Set(x => x.Type = "NewType");
            var match   = new ItemMatch <IParameterDefinition>(oldItem, newItem);
            var options = ComparerOptions.Default;

            var actual = SUT.CompareMatch(match, options).ToList();

            _output.WriteResults(actual);

            actual.Should().HaveCount(1);
            actual[0].ChangeType.Should().BeEquivalentTo(SemVerChangeType.Breaking);
        }
コード例 #3
0
        public void CompareMatchReturnsResultBasedOnDefaultValueChanges(string oldValue, string newValue,
                                                                        SemVerChangeType?expected)
        {
            var oldItem = new TestParameterDefinition().Set(x => x.DefaultValue = oldValue);
            var newItem = oldItem.JsonClone().Set(x => x.DefaultValue = newValue);
            var match   = new ItemMatch <IParameterDefinition>(oldItem, newItem);
            var options = ComparerOptions.Default;

            var actual = SUT.CompareMatch(match, options).ToList();

            _output.WriteResults(actual);

            if (expected == null)
            {
                actual.Should().BeEmpty();
            }
            else
            {
                actual.Should().HaveCount(1);
                actual[0].ChangeType.Should().BeEquivalentTo(expected);
            }
        }