Пример #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("无法验证不返回值的方法。");
        }
Пример #2
0
        public TOther ToMapped <TOther>()
            where TOther : new()
        {
            var result = new TOther();

            MapTo(result);

            return(result);
        }
Пример #3
0
        public TOther Convert <TOther, TOtherLength>()
            where TOtherLength : NumericValue <Length>, new()
            where TOther : Volume <TOtherLength>, new()
        {
            var    other           = new TOther();
            double conversionRatio = other.ConversionFactor / ConversionFactor;

            other.Value = Value * conversionRatio;
            return(other);
        }
Пример #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("验证此测试方法的正确性。");
        }
Пример #5
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("验证此测试方法的正确性。");
        }