Please Help me on this:
In here I need to call this Add(...) method through the Calling(...) method in MyAnotherClass. When I Assert it gives an error. Please show me the path.
public class MyClass { public List<int> number = new List<int>(); 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** } } Thanks
Begginer
mc.number[0]provide?