Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public bool CanBuildFrom(MethodInfo method)
 {
     return(RowTestFramework.IsRowTest(method));
 }