Esempio n. 1
0
        public void BuildFrom_SetsCommonNUnitAttributes()
        {
            RowTestAddIn addin = new RowTestAddIn();
            MethodInfo method = GetTestClassMethod("RowTestMethodWithCategory");

            Test test = addin.BuildFrom(method);

            Assert.That(test.Categories, Is.Not.Null);
            Assert.That(test.Categories.Count, Is.EqualTo(1));
            Assert.That(test.Categories[0], Is.EqualTo("Category"));
        }
        public void BuildFrom_SetsCommonNUnitAttributes()
        {
            RowTestAddIn addin  = new RowTestAddIn();
            MethodInfo   method = GetTestClassMethod("RowTestMethodWithCategory");

            Test test = addin.BuildFrom(method);

            Assert.That(test.Categories, Is.Not.Null);
            Assert.That(test.Categories.Count, Is.EqualTo(1));
            Assert.That(test.Categories[0], Is.EqualTo("Category"));
        }
        public void BuildFrom_WithoutRows()
        {
            RowTestAddIn addIn  = new RowTestAddIn();
            MethodInfo   method = GetTestClassMethod("MethodWithRowTestAttribute");

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite)test;

            Assert.That(suite.TestCount, Is.EqualTo(0));
        }
Esempio n. 4
0
        public void BuildFrom_SetsNameCorrectly()
        {
            RowTestAddIn addIn = new RowTestAddIn();
            Type testClass = typeof(TestClass);
            MethodInfo method = testClass.GetMethod(Method_RowTestMethodWith2Rows, BindingFlags.Public | BindingFlags.Instance);

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite) test;

            Assert.That(suite.TestName.Name, Is.EqualTo(method.Name));
            Assert.That(suite.TestName.FullName, Is.EqualTo(testClass.FullName + "." + method.Name));
        }
        public void BuildFrom_SetsNameCorrectly()
        {
            RowTestAddIn addIn     = new RowTestAddIn();
            Type         testClass = typeof(TestClass);
            MethodInfo   method    = testClass.GetMethod(Method_RowTestMethodWith2Rows, BindingFlags.Public | BindingFlags.Instance);

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite)test;

            Assert.That(suite.TestName.Name, Is.EqualTo(method.Name));
            Assert.That(suite.TestName.FullName, Is.EqualTo(testClass.FullName + "." + method.Name));
        }
        public void BuildFrom_WithNull()
        {
            RowTestAddIn addIn  = new RowTestAddIn();
            MethodInfo   method = GetTestClassMethod("RowTestMethodWithNullArgument");

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite)test;

            Assert.That(suite.TestCount, Is.EqualTo(1));
            Assert.That(suite.Tests[0], Is.InstanceOfType(typeof(RowTestCase)));

            RowTestCase testCase = (RowTestCase)suite.Tests[0];

            Assert.That(testCase.Arguments, Is.Null);
        }
        public void BuildFrom_WithTestName()
        {
            RowTestAddIn addIn  = new RowTestAddIn();
            MethodInfo   method = GetRowTestMethodWithTestName();

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite)test;

            Assert.That(suite.TestCount, Is.EqualTo(1));
            Assert.That(suite.Tests[0], Is.InstanceOfType(typeof(RowTestCase)));

            RowTestCase testCase = (RowTestCase)suite.Tests[0];

            Assert.That(testCase.TestName.Name, Is.EqualTo("UnitTest(4, 5)"));
        }
Esempio n. 8
0
        public void BuildFrom_WithExpectedException()
        {
            RowTestAddIn addIn = new RowTestAddIn();
            MethodInfo method = GetRowTestMethodWithExpectedException();

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite) test;

            Assert.That(suite.TestCount, Is.EqualTo(1));
            Assert.That(suite.Tests[0], Is.InstanceOfType(typeof(RowTestCase)));

            RowTestCase testCase = (RowTestCase) suite.Tests[0];

            Assert.That(testCase.ExceptionExpected, Is.True);
            Assert.That(testCase.ExpectedExceptionType, Is.EqualTo(typeof(InvalidOperationException)));
        }
        public void BuildFrom_WithExpectedException()
        {
            RowTestAddIn addIn  = new RowTestAddIn();
            MethodInfo   method = GetRowTestMethodWithExpectedException();

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite)test;

            Assert.That(suite.TestCount, Is.EqualTo(1));
            Assert.That(suite.Tests[0], Is.InstanceOfType(typeof(RowTestCase)));

            RowTestCase testCase = (RowTestCase)suite.Tests[0];

            Assert.That(testCase.ExceptionExpected, Is.True);
            Assert.That(testCase.ExpectedExceptionType, Is.EqualTo(typeof(InvalidOperationException)));
        }
        public void BuildFrom_WithRows()
        {
            RowTestAddIn addIn  = new RowTestAddIn();
            MethodInfo   method = GetRowTestMethodWith2Rows();

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite)test;

            Assert.That(suite.TestCount, Is.EqualTo(2));
            Assert.That(suite.Tests[0], Is.InstanceOfType(typeof(RowTestCase)));
            Assert.That(suite.Tests[1], Is.InstanceOfType(typeof(RowTestCase)));

            RowTestCase testCase1 = (RowTestCase)suite.Tests[0];
            RowTestCase testCase2 = (RowTestCase)suite.Tests[1];

            Assert.That(testCase1.Arguments.Length, Is.EqualTo(2));
            Assert.That(testCase2.Arguments.Length, Is.EqualTo(2));
        }
Esempio n. 11
0
        public void BuildFrom_WithTestName()
        {
            RowTestAddIn addIn = new RowTestAddIn();
            MethodInfo method = GetRowTestMethodWithTestName();

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite) test;

            Assert.That(suite.TestCount, Is.EqualTo(1));
            Assert.That(suite.Tests[0], Is.InstanceOfType(typeof(RowTestCase)));

            RowTestCase testCase = (RowTestCase) suite.Tests[0];

            Assert.That(testCase.TestName.Name, Is.EqualTo("UnitTest(4, 5)"));
        }
Esempio n. 12
0
        public void BuildFrom_WithSpecialValueNull()
        {
            RowTestAddIn addIn = new RowTestAddIn();
            MethodInfo method = GetTestClassMethod("RowTestMethodWithSpecialValue");

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite) test;

            Assert.That(suite.TestCount, Is.EqualTo(1));
            Assert.That(suite.Tests[0], Is.InstanceOfType(typeof(RowTestCase)));

            RowTestCase testCase = (RowTestCase) suite.Tests[0];

            Assert.That(testCase.Arguments.Length, Is.EqualTo(1));
            Assert.That(testCase.Arguments[0], Is.Null);
        }
Esempio n. 13
0
        public void BuildFrom_WithRows()
        {
            RowTestAddIn addIn = new RowTestAddIn();
            MethodInfo method = GetRowTestMethodWith2Rows();

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite) test;

            Assert.That(suite.TestCount, Is.EqualTo(2));
            Assert.That(suite.Tests[0], Is.InstanceOfType(typeof(RowTestCase)));
            Assert.That(suite.Tests[1], Is.InstanceOfType(typeof(RowTestCase)));

            RowTestCase testCase1 = (RowTestCase) suite.Tests[0];
            RowTestCase testCase2 = (RowTestCase) suite.Tests[1];

            Assert.That(testCase1.Arguments.Length, Is.EqualTo(2));
            Assert.That(testCase2.Arguments.Length, Is.EqualTo(2));
        }
Esempio n. 14
0
        public void BuildFrom_WithoutRows()
        {
            RowTestAddIn addIn = new RowTestAddIn();
            MethodInfo method = GetTestClassMethod("MethodWithRowTestAttribute");

            Test test = addIn.BuildFrom(method);

            Assert.That(test, Is.InstanceOfType(typeof(RowTestSuite)));
            RowTestSuite suite = (RowTestSuite) test;

            Assert.That(suite.TestCount, Is.EqualTo(0));
        }