title: unit testing Method calling from another method in c#
body: <p><strong>Please Help me on this:</strong></p>
  
  <p>In here I need to call this <code>Add(...)</code> method through the <code>Calling(...)</code> method in <code>MyAnotherClass</code>. When I <code>Assert</code> it gives an error. Please show me the path.</p>
  
  <pre><code>public class MyClass
  {
      public List&lt;int&gt; number = new List&lt;int&gt;();
  
      public void Add(int a, int b)
      {   
          int c = a + b;
          number.Add(c);
      }
   }
  
  public class MyAnotherClass
  {
      public void CallingMethod(int c, int d)
      {          
          MyClass mc = new MyClass();
          mc.Add( c, d);
      }
  }
  
  [TestClass]
  public class UnitTest1
  {
      [TestMethod]
      public void TestMethod1()
      {
          MyAnotherClass mac = new MyAnotherClass();
  
          MyClass mc = new MyClass();
  
          mc.Add(2, 3);
          Assert.AreEqual(5, mc.number[0]);// **this work fine** 
  
          mac.CallingMethod(2, 3);
          Assert.AreEqual(5, mc.number[0]);// **but this not**
      }
  }
  </code></pre>
  
  <p>Thanks</p>
  
  <p><strong>Begginer</strong></p>