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; }
private PythonFixture BuildFixture(OldClass pythonClass) { var 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; }