public static PersonEx2StringDate CreatePersonEx2StringDate() { PersonEx2StringDate p = CreatePersonCore <PersonEx2StringDate>(); p.BirthDate = DateTime.Now.AddYears(-21).ToShortDateString(); return(p); }
public void CompareCoercesToStringOnPropertyTypeMismatch() { //Arrange. PersonEx2 p1 = ModelsHelper.CreatePersonEx2(); PersonEx2StringDate p2 = ModelsHelper.CreatePersonEx2StringDate(); ObjectComparer comparer = ObjectComparer.Create <PersonEx2, PersonEx2StringDate>(); //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.StringCoercion); }