private void AddTestMethodsToFixture(PythonFixture fixture)
 {
     foreach (PythonTestCase testCase in fixture)
     {
         Add(new PythonTestMethod(fixture.Name, testCase.Name, fixture, testCase));
     }
 }
 public PythonFixtureExtension(PythonFixture fixture)
     : base(typeof (PythonFixture))
 {
     Fixture = fixture;
     SetFixtureName(fixture);
     SetFixtureSetupAndTearDownMethods(fixture);
     AddTestMethodsToFixture(fixture);
 }
        private void SetFixtureSetupAndTearDownMethods(PythonFixture fixture)
        {
            Type fixtureType = fixture.GetType();

            fixtureSetUp = Reflect.GetNamedMethod(fixtureType, "FixtureSetup",
                                                  BindingFlags.Public | BindingFlags.Instance);
            fixtureTearDown = Reflect.GetNamedMethod(fixtureType, "FixtureTeardown",
                                                     BindingFlags.Public | BindingFlags.Instance);
        }
        public PythonTestMethod(string path, string name, PythonFixture fixture, PythonTestCase testCase)
            : base(path, name)
        {
            if (fixture == null) throw new ArgumentNullException("fixture");
            if (testCase == null) throw new ArgumentNullException("testCase");

            _fixture = fixture;
            _testCase = testCase;

            testFramework = TestFramework.FromAssembly(GetType().Assembly);
        }
Ejemplo n.º 5
0
        public void RunFailingTest()
        {
            MyPythonSuite suite = new MyPythonSuite();

            suite.Setup();

            PythonFixtureBuilder builder = new PythonFixtureBuilder(suite.Engine);
            PythonFixture        fixture = builder.BuildFixtures()[0];

            fixture["testFail"].Execute();
        }
        public PythonFixtureExtension(PythonFixture fixture, int assemblyKey)
            : base(fixture.Name, assemblyKey)
        {
            _fixture = fixture;

            testFramework = TestFramework.FromAssembly(GetType().Assembly);

            foreach (PythonTestCase testCase in _fixture)
            {
                Add(new PythonTestMethod(fixture.Name, testCase.Name, fixture, testCase));
            }
        }
        public PythonFixtureExtension(PythonFixture fixture, int assemblyKey)
            : base(fixture.Name, assemblyKey)
        {
            _fixture = fixture;

            testFramework = TestFramework.FromAssembly(GetType().Assembly);

            foreach (PythonTestCase testCase in _fixture)
            {
                Add(new PythonTestMethod(fixture.Name, testCase.Name, fixture, testCase));
            }
        }
Ejemplo n.º 8
0
        public void RunSetupAndTeardowns()
        {
            MyPythonSuite suite = new MyPythonSuite();

            suite.Setup();

            PythonFixtureBuilder builder = new PythonFixtureBuilder(suite.Engine);
            PythonFixture        fixture = builder.BuildFixtures()[0];

            fixture.FixtureSetup();
            fixture.Setup();
            fixture.Teardown();
            fixture.FixtureTeardown();
        }
Ejemplo n.º 9
0
        public PythonTestMethod(string path, string name, PythonFixture fixture, PythonTestCase testCase)
            : base(path, name)
        {
            if (fixture == null)
            {
                throw new ArgumentNullException("fixture");
            }
            if (testCase == null)
            {
                throw new ArgumentNullException("testCase");
            }

            _fixture  = fixture;
            _testCase = testCase;

            testFramework = TestFramework.FromAssembly(GetType().Assembly);
        }
        private PythonFixture BuildFixture(OldClass pythonClass)
        {
            PythonFixture fixture = new PythonFixture((string) pythonClass.__name__);

            OldInstance instance = _createInstance(pythonClass);

            // assing the test methods

            foreach (string methodName in FindTestMethods(pythonClass, TestMethodPrefix))
            {
                fixture.Add(new PythonTestCase(methodName, MakeProc(instance, methodName)));
            }

            // assign the setup and tear down methods

            fixture.SetFixtureSetup(MakeProc(instance, "setUpFixture"));
            fixture.SetFixtureTeardown(MakeProc(instance, "tearDownFixture"));
            fixture.SetSetup(MakeProc(instance, "setUp"));
            fixture.SetTeardown(MakeProc(instance, "tearDown"));

            // all done

            return fixture;
        }
 private void SetFixtureName(PythonFixture fixture)
 {
     TestName.FullName = fixture.Name;
     TestName.Name = fixture.Name;
 }