title: Whether I am writing the correct test method in Unit Test?
body: <p>I am develeloping MVC application and writing the unit test.
  I am confused about the coding pattern/process of unit test.
  I am writing the unit test but I am not aware of , whether I am writing in proper way or not.</p>
  <p>I am giving one example of the test case please check.</p>
  <p>Basically, in test method I am writing the same code which I have written in  GetPartiesByEmployee() method and I am comparing the no. of records which return from the method and the records return from code blog in test method is that correct ?</p>
  <p>Is that correct  ?</p>
  <blockquote>
  <p>[TestMethod]</p>
  <pre><code>    public void Test_Get_Parties_By_Employee_Method()
      {
       
          var actualResult = oPartyHelper.GetPartiesByEmployee(6);
          Employee oEmployee = new Employee();
          oEmployee = db.Employees.Find(6);
          var roles = oEmployee.Roles.ToList();
          List&lt;Party&gt; parties = new List&lt;Party&gt;();
          foreach (Role item in roles)
          {
              var PartyCollection = from e in item.Parties.OrderBy(e =&gt; e.Name)
                                    where (e.IsDeleted == false || e.IsDeleted == null)
                                    select e;
              parties.AddRange(PartyCollection.ToList());               
          }
          parties=parties.Distinct().OrderBy(p =&gt; p.Id).ToList();
          var expectedCount = parties.Count();
          var actualList = (List&lt;Party&gt;)actualResult;
          var actualCount = actualList.Count;
          Assert.AreEqual(expectedCount, actualCount, &quot;All parties are not same&quot;);
      }
  </code></pre>
  </blockquote>
  <p>Actual Method :</p>
  <pre><code>public List&lt;Party&gt; GetPartiesByEmployee(int employeeId)
          {
              Employee oEmployee = new Employee();
              oEmployee = db.Employees.Find(employeeId);
              var roles = oEmployee.Roles.ToList();
              List&lt;Party&gt; parties = new List&lt;Party&gt;();
              foreach (Role item in roles)
              {
                  var PartyCollection = from e in item.Parties.OrderBy(e =&gt; e.Name)
                                        where (e.IsDeleted == false || e.IsDeleted == null)
                                        select e;
  
                  parties.AddRange(PartyCollection.ToList());
  
              }
              
              return parties.Distinct().OrderBy(p=&gt;p.Id).ToList();             
          }
  </code></pre>