예제 #1
0
        public void CompareNonNullableToNullableSameBaseType(bool nullDate)
        {
            //Arrange.
            PersonEx2NonNullable p1       = ModelsHelper.CreatePersonEx2NonNullable();
            PersonEx2            p2       = ModelsHelper.CreatePersonEx2(nullDate);
            ObjectComparer       comparer = ObjectComparer.Create <PersonEx2NonNullable, PersonEx2>();

            //Act.
            var result = comparer.Compare(p1, p2, out bool _);

            //Assert.
            result.Should().NotBeNull();
            PropertyComparisonResult propResult = result[nameof(PersonEx2.BirthDate)];

            propResult.Should().NotBeNull();
            (propResult.Result & ComparisonResult.StringCoercion).Should().Be(ComparisonResult.Undefined, "Comparison without coercion is possible.");
        }