2

I'd like to do a deep object comparison with FluentAssertions' awesome ShouldBeEquivalent method that excludes read-only properties. The following works:

x.ShouldBeEquivalentTo(y, opts => opts.Excluding(si => !si.PropertyInfo.CanWrite));

But PropertyInfo is marked obsolete with the warning "This property will be removed in a future version. Use SelectedMemberInfo instead." That type contains contains Name, MemberType, and DeclaringType and that's all, so not nearly enough to make certain checks against properties. (Internally it looks like the instance is actually a PropertySelectedMemberInfo, which adds nothing more.)

So what is the recommended, non-obsolete way make these sorts of checks against properties? Is SelectedMemberInfo still a work in progress?

Todd Menier
  • 37,557
  • 17
  • 150
  • 173
  • We should have checked SO more pro-actively, because now we removed this property and it misses an option to get access to the PropertyInfo. We will need to add that to 4.2 or 4.3. – Dennis Doomen Jan 06 '16 at 17:59
  • Thanks! I probably should have logged it on GitHub at the time instead. – Todd Menier Jan 06 '16 at 20:17

0 Answers0