title: Comparing nested object properties using SemanticComparison
body: <p>I'm creating the unit test that will need to compare two objects of the same type memberwise. I've decided to use SemanticComparison library to handle this task without writing custom comparer code. It works really well when comparing flat objects, there are problems when the object contains nested object that also need to be compared memberwise.</p>
  
  <pre><code>public class Outer
  {
      public string Name { get; set; }
      public Inner Inner { get; set; }
  }
  
  public class Inner
  {
      public string Name { get; set; }
      public string Value { get; set; }
  }
  
  public class Service
  {
      public Outer Method()
      {
          return new Outer()
          {
              Name = "outerName",
              Inner = new Inner()
              {
                  Name = "innerName",
                  Value = "value1"
              }
          };
      }
  }
  </code></pre>
  
  <p><strong>This won't work because Inner object is compared by reference, not memberwise:</strong></p>
  
  <pre><code>    [Test]
      public void SimpleTest1()
      {
  
          // setup
          var expectedLikeness = new Outer()
          {
              Name = "outerName",
              Inner = new Inner()
              {
                  Name = "innerName",
                  Value = "value1"
              }
          }.AsSource().OfLikeness&lt;Outer&gt;();
  
          var sut = new Service();
          // exercise sut
          var actual = sut.Method();
          // verify
          expectedLikeness.ShouldEqual(actual);
      }
  </code></pre>
  
  <p>To make it work I had to create proxy of the nested object so that it overrides the default equals implementation.</p>
  
  <pre><code>    [Test]
      public void SimpleTest2()
      {
  
          // setup
          var expectedLikeness = new Outer()
          {
              Name = "outerName",
              Inner = new Inner()
              {
                  Name = "innerName",
                  Value = "value1"
              }.AsSource().OfLikeness&lt;Inner&gt;().CreateProxy()
          }.AsSource().OfLikeness&lt;Outer&gt;();
  
          var sut = new Service();
          // exercise sut
          var actual = sut.Method();
          // verify
          expectedLikeness.ShouldEqual(actual);
      }
  </code></pre>
  
  <p>Well, it works properly, but imagine that after some service code refactoring we introduce the bug that causes the value property of the Inner class be different from the expected value. 
  The cool feature of the SemanticComparison is that it can log the name of the member that causes inequality. But, in this case, it'll only return "Inner" as mismatch, not the name of the specific property in the Inner class.</p>
  
  <p>Am I missing something? Is it possible to configure it to be able to return actual mismatch member.</p>
  
  <p>This is obviously not an issue for simple data structures as in this example, but it could be an inconvenience for testing a real life code.</p>