// //编写测试时,还可使用以下特性: // //使用 ClassInitialize 在运行类中的第一个测试前先运行代码 //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //使用 ClassCleanup 在运行完类中的所有测试后再运行代码 //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //使用 TestInitialize 在运行每个测试前先运行代码 //[TestInitialize()] //public void MyTestInitialize() //{ //} // //使用 TestCleanup 在运行完每个测试后运行代码 //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion /// <summary> ///SwithCase`2 构造函数 的测试 ///</summary> public void SwithCaseExtension_SwithCaseConstructorTestHelper <TCase, TOther>() { TCase value = default(TCase); Action <TOther> action = null; SwithCaseExtension.SwithCase <TCase, TOther> target = new SwithCaseExtension.SwithCase <TCase, TOther>(value, action); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
/// <summary> ///Switch 的测试 ///</summary> public void SwitchTestHelper <TCase, TOther>() where TCase : IEquatable <T> { TCase t = default(TCase); Action <TOther> action = null; SwithCaseExtension.SwithCase <TCase, TOther> expected = null; SwithCaseExtension.SwithCase <TCase, TOther> actual; actual = SwithCaseExtension.Switch <TCase, TOther>(t, action); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
// //编写测试时,还可使用以下特性: // //使用 ClassInitialize 在运行类中的第一个测试前先运行代码 //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //使用 ClassCleanup 在运行完类中的所有测试后再运行代码 //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //使用 TestInitialize 在运行每个测试前先运行代码 //[TestInitialize()] //public void MyTestInitialize() //{ //} // //使用 TestCleanup 在运行完每个测试后运行代码 //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion /// <summary> ///Case 的测试 ///</summary> public void CaseTestHelper <TCase, TOther>() where TCase : IEquatable <T> { SwithCaseExtension.SwithCase <TCase, TOther> sc = null; TCase option = default(TCase); TOther other = default(TOther); SwithCaseExtension.SwithCase <TCase, TOther> expected = null; SwithCaseExtension.SwithCase <TCase, TOther> actual; actual = SwithCaseExtension.Case <TCase, TOther>(sc, option, other); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> ///Value 的测试 ///</summary> public void ValueTestHelper <TCase, TOther>() { PrivateObject param0 = null; SwithCaseExtension_Accessor.SwithCase <TCase, TOther> target = new SwithCaseExtension_Accessor.SwithCase <TCase, TOther>(param0); TCase expected = default(TCase); TCase actual; target.Value = expected; actual = target.Value; Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
protected TCollection GetCaseObjects <TCase, TCollection>() where TCase : CaseObjectBase, new() where TCollection : List <TCase>, new() { var result = new TCollection(); foreach (var item in Cases) { var itemObject = new TCase(); itemObject.Min = item.Min; itemObject.Max = item.Max; itemObject.Item = item.Item; result.Add(itemObject); } return(result); }