???????????????????????????Visual Studio???????δ???????????????????????????????????ExpectedException???????????????????Assert??????FibonacciTest()????????????
????1         [TestMethod]
????2         public void FibonacciTest()
????3         {
????4             const int FACTOR = 8;
????5             const int Expected = 21;
????6             int actual = ExtendedMath.Functions.Fibonacci(FACTOR);
????7
????8             Assert.AreEqual(Expected?? actual);
????9         }
???????д?????????????3A?????а???——Arrange?? Act?? Assert. ???????????????????????????????????????????????????????????????A????y??????????????Ρ?
???????TestInitialize?????????????????÷?????????????????????????????????????Ρ???????TestCleanup?????????????????????????С?????????????????????Щ????????????????е??????????????в???????????TestInitialize??????????????е?????????????????????????????TestCleanup??
??????????ж???ε??????ClassInitialize??ClassCleanup????????????????????Ρ???????????????????????????TestContext????????????
???????????ClassInitialize??ClassCleanup?????????????????????????????????????????AssemblyInitialize??AssemblyCleanup????????磬??AssemblyInitialize???ε??????????????????????????????????У??????????????????е???????Щ????????????????????????TestContext??????????
???????????????й????????????????????AssemblyInitialize??AssemblyCleanup???????????????????????????ó?????????????????????ó?????????????
??????????????????????÷???????????????????????б???
????Assert.AreSame/Asser.AreNotSame?????÷???????????????????????????????????????????????????????????????????????????????????????????
????????????????????????TestContext??????????????????????????????????????????????????????????????????????洢???????????????????????
???????????????????????????????????????????д???Visual Studio?????????????????????????????????????????????????????ж???????Ρ?
??????ζ???????г?????в???????????????д?????к????????????????????????????????????????????????????????÷????????????????????????г?????????4??????????
????1. ????????????г??????????г??
????2. ????????????г??????????????????????????????????????internalsVisibleTo??????
????3. ?????????????г???????????г???????????????Щ???г?????в???
????4. ?????????.NET???????????????Щ????г??
??????????????????????????????κ???????в????
????1     public class Example
????2     {
????3         public Example()
????4         { }
????5         private string password = "letmein";
????6         private bool VerifyPassword(string password)
????7         {
????8             return (string.Compare(this.password?? password?? false) == 0);
????9         }
????10     }
????Visual Studio??????PrivateObject????????????????????????????????????????????????????г???????????????????????????????????????????????賬??????Type????
1 namespace Explorations
2 {
3     [TestClass]
4     public class ExampleTest
5     {
6         private PrivateObject privateObject;
7         const string PASSWORD = "letmein";
8
9         [TestInitialize]
10         public void TestInitialize()
11         {
12             privateObject = new PrivateObject(typeof(Example));
13         }
14     }
15 }