public RowTestCase CreateRowTestCase(Attribute row, MethodInfo method)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            object[] rowArguments = RowTestFramework.GetRowArguments(row);
            rowArguments = FilterSpecialValues(rowArguments);

            string testName = RowTestFramework.GetTestName(row);
            Type   expectedExceptionType = RowTestFramework.GetExpectedExceptionType(row);

            RowTestCase testCase = new RowTestCase(method, testName, rowArguments);

            if (expectedExceptionType != null)
            {
                testCase.ExceptionExpected     = true;
                testCase.ExpectedExceptionType = expectedExceptionType;
                testCase.ExpectedMessage       = RowTestFramework.GetExpectedExceptionMessage(row);
            }

            return(testCase);
        }
        private object[] FilterSpecialValues(object[] arguments)
        {
            if (arguments == null)
            {
                return(null);
            }

            for (int i = 0; i < arguments.Length; i++)
            {
                if (RowTestFramework.IsSpecialValue(arguments[i]))
                {
                    arguments[i] = MapSpecialValue(arguments[i]);
                }
            }

            return(arguments);
        }
示例#3
0
        public Test BuildFrom(MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            RowTestSuite suite = _testFactory.CreateRowTestSuite(method);

            Attribute[] rows = RowTestFramework.GetRowAttributes(method);

            foreach (Attribute row in rows)
            {
                suite.Add(_testFactory.CreateRowTestCase(row, method));
            }

            return(suite);
        }
示例#4
0
 public bool CanBuildFrom(MethodInfo method)
 {
     return(RowTestFramework.IsRowTest(method));
 }