Exemplo n.º 1
0
        /// <summary>
        /// 执行测试
        /// </summary>
        public override void ExecuteTest()
        {
            TResult <string> result = new TResult <string>("Test String 1");

            if (!result)
            {
                PrintLogLn(MsgType.Error, result.ToString());
            }
            else
            {
                PrintLogLn(MsgType.Success, result.Result);
            }

            result = new TResult <string>(null, TestEnum.TestItem);
            if (!result)
            {
                PrintLogLn(MsgType.Error, result.ToString());
            }
            else
            {
                PrintLogLn(MsgType.Success, result.Result);
            }

            try { int zero = 0; zero /= zero; }
            catch (Exception ex) { result = new TResult <string>(null, ex); }
            if (!result)
            {
                PrintLogLn(MsgType.Error, result.ToString());
            }
            else
            {
                PrintLogLn(MsgType.Success, result.Result);
            }

            result = new TResult <string>(null, "Error String 1");
            if (!result)
            {
                PrintLogLn(MsgType.Error, result.ToString());
            }
            else
            {
                PrintLogLn(MsgType.Success, result.Result);
            }

            result = new TResult <string>("Test String 3", 0, null);
            if (!result)
            {
                PrintLogLn(MsgType.Error, result.ToString());
            }
            else
            {
                PrintLogLn(MsgType.Success, result.Result);
            }
        }