Adding extensions

Oct 26, 2011 at 7:12 PM

Hi,

First time posting, so be patient!  :)

Is it possible to add extensions to the extensions?

i.e. I would like to something like "Should().HaveAllPropertiesEqual(obj1, obj2)" where I use use reflection to compare each properties (public and private) to make sure that two objects are equivalent.  For some reason the objects that I'm comparing are not properly evaluating when I simply use the _actualObject.Should().Be.EqualTo(_expectedObject).  I've proven that when I use my "reflective comparer" they are equal.

Thoughts??

Coordinator
Oct 26, 2011 at 8:11 PM

First I would know the reason because EqualTo seems to not work properly... I have used it in practice with any kind of standard and custom classes.

btw yes you can extend IClassConstraints and/or IClassBeConstraints 

Oct 26, 2011 at 8:24 PM

Fabio,

Thank you for the validation that I'm not 'seeing things' with EqualTo!  :)

Any chance you could point me to some documentation/examples on how to do the extensions??

Coordinator
Oct 26, 2011 at 8:28 PM

Sure, SharpTestsEx is itself done by extensions

http://sharptestex.codeplex.com/SourceControl/changeset/view/075a7fa79bf9#SharpTestsEx%2fSharpTestsEx%2fClassConstraintsExtensions.cs