public TestResult Run(string exePath, string exercise) { if(!File.Exists(exePath)) throw new SwpTestToolException("Der angegebene Pfad führt zu keiner Exe Datei"); TypeProvider.Initialize(_loggerFacade, exePath); var exerciseTestDefintion = ExerciseTestDefintionFactory.Get(exercise); var defaultTestAssemblyBuilder = new DefaultTestAssemblyBuilder(); var nUnitTestAssemblyRunner = new NUnitTestAssemblyRunner(defaultTestAssemblyBuilder); var testGroupResults = new TestResult(); foreach (var testDefintion in exerciseTestDefintion.TestDefintions) { var typeMappingContainer = new TypeMappingContainer(); testDefintion.RegisterTypeMappings(typeMappingContainer); TypeProvider.RegisterTypeMappings(typeMappingContainer); if(!TypeProvider.CheckIfAttributeAssemblyExists()) break; if(!TypeProvider.CheckCorrectVersionOfAttributeAssembly(testDefintion.GetAssemblyIdentifier)) break; var testListener = new CustomTestListener(testDefintion.TestGroupName); nUnitTestAssemblyRunner.Load(Assembly.GetAssembly(testDefintion.GetAssemblyIdentifier), new Dictionary<string, string>()); nUnitTestAssemblyRunner.Run(testListener, new TestMethodFilter()); testGroupResults.AddTestCaseGroupResult(testListener.TestCaseGroupResult); } return testGroupResults; }
public static void ClassesCanBeImpliedToBeFixtures() { var assemblyTest = new DefaultTestAssemblyBuilder().Build( typeof(ImpliedFixture).GetTypeInfo().Assembly, options: new Dictionary <string, object>()); Assert.That( new[] { assemblyTest }.SelectManyRecursive(test => test.Tests), Has.Some.With.Property("Type").EqualTo(typeof(ImpliedFixture))); }
public void SetUp() { _mockAssemblyPath = Path.Combine(TestContext.CurrentContext.TestDirectory, MOCK_ASSEMBLY_FILE); _builder = new DefaultTestAssemblyBuilder(); }