title: AutoFixture - Likeness. Comparison of complex objects
body: <p>I am trying to compare 2 complex objects with AutoFixture's <code>OfLikeness</code> but unfortunately without success. While comparing nested objects( also with <code>OfLikeness</code>) works as expected, comparing a master object results with error saying that child objects don't match. I assume that the problem is that Likeness apply semantic comparrer only to a master object and nested objects are compared using default Equal implementation which checks for reference match(May be my assumption is wrong?). </p>
  
  <p>This could clarify what I am trying to achieve:</p>
  
  <pre><code>public class ComplexMasterObject{
      public ChildFirst child1 {get;set;}
      public ChildSecond child2 {get;set;}
      public string SimpleProp {get;set;}
  }
  
  public class ChildFirst {
      public string SomeStringProp1 {get;set;}
      public int  SomeIntProp1 {get;set;}
  }
  
  public class ChildSecond {
      public string SomeStringProp1 {get;set;}
      public int  SomeIntProp1 {get;set;}
  }
  </code></pre>
  
  <p>Test:</p>
  
  <pre><code>public void TestLikeness_Success()
  {
       var expected = new ComplexMasterObject {
           Child1 = new ChildFirst {
               SomeStringProp1 = "ChildFirst SomeStringProp1",
               SomeIntProp1 = 1
           },
           Child2 = new ChildSecond {
               SomeStringProp1 = "ChildSecond SomeStringProp1",
               SomeIntProp1 = 2
           },
           SimpleProp = "ComplexMasterObject SimpleProp"
       };
  
       var input = new ComplexMasterObject {
           Child1 = new ChildFirst {
               SomeStringProp1 = "ChildFirst SomeStringProp1",
               SomeIntProp1 = 1
           },
           Child2 = new ChildSecond {
               SomeStringProp1 = "ChildSecond SomeStringProp1",
               SomeIntProp1 = 2
           },
           SimpleProp = "ComplexMasterObject SimpleProp"
       };
  
       var child1Likeness = expected.Child1.AsSource().OfLikeness&lt;ChildFirst&gt;();
       var child2Likeness = expected.Child2.AsSource().OfLikeness&lt;ChildSecond&gt;();
  
       var masterLikeness = expected.AsSource().OfLikeness&lt;ComplexMasterObject&gt;();
       child1Likeness.ShouldEqual(input.Child1); //Passes
       child2Likeness.ShouldEqual(input.Child2); //Passes
  
       masterLikeness.ShouldEqual(input); 
       // The provided value `ComplexMasterObject` did not match the expected value `ComplexMasterObject`. The following members did not match:
    - Child1.
    - Child2.
  }
  </code></pre>
  
  <p>When I serialize <code>expected</code> and <code>input</code> objects to JSON and compare the results, they are identical.</p>
  
  <p>I tried to use Resemblance, But it didn't work either:</p>
  
  <pre><code>var proxy = expected.AsSource().OfLikeness&lt;ComplexMasterObject&gt;().CreateProxy();
  proxy.Equals(input); // returns false
  </code></pre>
  
  <p>How can perform a semantic comparison on complex object including nested complex properties?</p>
  
  <p>Thank you in advance.</p>