Exemplo n.º 1
0
        /// <summary>
        ///Default 的测试
        ///</summary>
        public void DefaultTestHelper <TCase, TOther>()
        {
            SwithCaseExtension.SwithCase <TCase, TOther> sc = null;
            TOther other = default(TOther);

            SwithCaseExtension.Default <TCase, TOther>(sc, other);
            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>
        ///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: 实现用来验证目标的代码");
        }
Exemplo n.º 3
0
        /// <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("验证此测试方法的正确性。");
        }
Exemplo n.º 4
0
        /// <summary>
        ///Case 的测试
        ///</summary>
        public void CaseTest1Helper <TCase, TOther>()
            where TCase : IEquatable <T>
        {
            SwithCaseExtension.SwithCase <TCase, TOther> sc = null;
            Predicate <TCase> predict = null;
            TOther            other   = default(TOther);

            SwithCaseExtension.SwithCase <TCase, TOther> expected = null;
            SwithCaseExtension.SwithCase <TCase, TOther> actual;
            actual = SwithCaseExtension.Case <TCase, TOther>(sc, predict, other);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Exemplo n.º 5
0
        /// <summary>
        ///Switch 的测试
        ///</summary>
        public void SwitchTest1Helper <TInput, TCase, TOther>()

            where TCase : IEquatable <T>
        {
            TInput t = default(TInput);
            Func <TInput, TCase> selector = null;
            Action <TOther>      action   = null;

            SwithCaseExtension.SwithCase <TCase, TOther> expected = null;
            SwithCaseExtension.SwithCase <TCase, TOther> actual;
            actual = SwithCaseExtension.Switch <TInput, TCase, TOther>(t, selector, action);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Exemplo n.º 6
0
        /// <summary>
        ///Case 的测试
        ///</summary>
        public void CaseTest2Helper <TCase, TOther>()
            where TCase : IEquatable <T>
        {
            SwithCaseExtension.SwithCase <TCase, TOther> sc = null;
            TCase  option = default(TCase);
            TOther other  = default(TOther);
            bool   bBreak = false;

            SwithCaseExtension.SwithCase <TCase, TOther> expected = null;
            SwithCaseExtension.SwithCase <TCase, TOther> actual;
            actual = SwithCaseExtension.Case <TCase, TOther>(sc, option, other, bBreak);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }