title: Creating a IEqualityComparer<IEnumerable<T>>
body: <p>I'm using xUnit and it doesn't have a way to determine if 2 <code>IEnumerable&lt;T&gt;</code> are equal if <code>T</code> is custom type.</p>
  
  <p>I've tried using <code>LINQ SequenceEqual</code> but again as the instances of <code>T</code> are different this returns false;</p>
  
  <p>Here is a basic test with a non-working <code>IEqualityComparer</code></p>
  
  <pre><code>    [Fact]
      public void FactMethodName()
      {
          var one = new[] { new KeywordSchedule() { Id = 1 } };
          var two = new[] { new KeywordSchedule() { Id = 1 } };
  
          Assert.Equal(one, two, new KeywordScheduleComparer());
      }
  
  public class KeywordScheduleComparer : IEqualityComparer&lt;IEnumerable&lt;KeywordSchedule&gt;&gt;
  {
      public bool Equals(IEnumerable&lt;KeywordSchedule&gt; x, IEnumerable&lt;KeywordSchedule&gt; y)
      {
          return Object.ReferenceEquals(x, y) || (x != null &amp;&amp; y != null &amp;&amp; x.SequenceEqual(y));
      }
  
      public int GetHashCode(IEnumerable&lt;KeywordSchedule&gt; obj)
      {
          if (obj == null)
              return 0;
  
          return unchecked(obj.Select(e =&gt; e.GetHashCode()).Aggregate(0, (a, b) =&gt; a + b));  // BAD
      }
  }
  </code></pre>
  
  <p>I'm using this in an integration test, so I insert data from a IEnumerable into a DB at the start, then call my SUT to retrieve data from DB and compare.</p>
  
  <p>If you can help me get a collection comparison working I'd appreciate it!</p>