示例#1
0
        public override TestResult Execute(T sut)
        {
            DateTime now = DateTime.Now;

            TestResultWithException <T, TException> result = new TestResultWithException <T, TException>(this, default(T), null, now, now);

            return(result);
        }
示例#2
0
        public override TestResult Execute(T instance)
        {
            TException caughtException = null;
            TResult    result = default(TResult);
            DateTime   end, start = DateTime.Now;

            try
            {
                result = Func(instance);
                end    = DateTime.Now;
            }
            catch (TException ex)
            {
                end             = DateTime.Now;
                caughtException = ex;
            }

            TestResultWithException <T, TException> testResult = new TestResultWithException <T, TException>(this, instance, caughtException, start, end);

            return(testResult);
        }
示例#3
0
        public override TestResult Execute(T instance)
        {
            TException caughtException = null;
            DateTime   end, start = DateTime.Now;

            try
            {
                Action(instance);
                end = DateTime.Now;
            }
            catch (TException ex)
            {
                end             = DateTime.Now;
                caughtException = ex;
            }

            bool success = caughtException != null;

            TestResultWithException <T, TException> testResult = new TestResultWithException <T, TException>(this, instance, caughtException, start, end);

            return(testResult);
        }