Beispiel #1
0
        private void RunTestMethod(MethodInfo methodInfo, object classInstance)
        {
            _testSetUpMethods.ForEach(m => m.Invoke(classInstance, new object[0]));
            var methodTestCasesArgs = methodInfo.GetCustomAttributes <TestCaseAttribute>(false)
                                      .Select(testCase => testCase.Arguments)
                                      .ToList();

            if (!methodTestCasesArgs.Any())
            {
                methodTestCasesArgs.Add(new object[0]);
            }

            methodTestCasesArgs.ForEach(args =>
            {
                _logger.LogStart(methodInfo, args);
                try
                {
                    methodInfo.Invoke(classInstance, args);
                    _logger.LogResult(true);
                }
                catch (Exception e)
                {
                    _logger.LogResult(false);
                }
            });
        }