title: Assert to compare two lists of objects C#
body: <p>I am currently trying to learn how to use unit testing, and I have created the actual list of 3 animal objects and the expected list of 3 animal objects. The question is how do I Assert to check the lists are equal? I have tried CollectionAssert.AreEqual and Assert.AreEqual but to no avail. Any help would be appreciated.</p>
  
  <p>The test method:</p>
  
  <pre><code>  [TestMethod]
      public void createAnimalsTest2()
      {
          animalHandler animalHandler = new animalHandler();
          // arrange
          List&lt;Animal&gt; expected = new List&lt;Animal&gt;();
          Animal dog = new Dog("",0);
          Animal cat = new Cat("",0);
          Animal mouse = new Mouse("",0);
          expected.Add(dog);
          expected.Add(cat);
          expected.Add(mouse);
          //actual
          List&lt;Animal&gt; actual = animalHandler.createAnimals("","","",0,0,0);
  
  
          //assert
          //this is the line that does not evaluate as true
          Assert.Equals(expected ,actual);
  
      }
  </code></pre>