title: How to compare Lists in Unit Testing
body: <p>How can this test fail?</p>
  
  <pre class="lang-cs prettyprint-override"><code>[TestMethod]
  public void Get_Code()
  {
      var expected = new List&lt;int&gt;();
      expected.AddRange(new [] { 100, 400, 200, 900, 2300, 1900 });
  
      var actual = new List&lt;int&gt;();
      actual.AddRange(new [] { 100, 400, 200, 900, 2300, 1900 });
  
      Assert.AreEqual(expected, actual);
      // Assert.AreSame(expected, actual)       fails
      // Assert.IsTrue(expected.Equals(actual)) fails
  }
  </code></pre>