值类型与引用类型的简单测试。
1 [TestClass] 2 public class HomeControllerTest 3 { 4 [TestMethod] 5 public void ZhiTest() 6 { 7 int a = 10; 8 Zhi(a); 9 Assert.AreEqual(11, a); 10 } 11 public void Zhi(int a) 12 { 13 a++; 14 } 15 16 [TestMethod] 17 public void YinyongTest() 18 { 19 List<int> list = new List<int>(); 20 Yinyong(list); 21 Assert.AreEqual(1, list[0]); 22 } 23 public void Yinyong(List<int> list) 24 { 25 list.Add(1); 26 } 27 28 }