public LoadAssembly ( LoadMethod loadMethod, string assemblyPath, string pdbPath = null ) : |
||
loadMethod | LoadMethod | |
assemblyPath | string | |
pdbPath | string | |
Résultat |
/// <inheritdoc /> public ITestRunResult RunTests(IAssemblyTarget target, IAssemblyTarget tests) { ITestRunResult result; try { // Load tests and target var loader = new AssemblyLoader(); loader.LoadAssemblyWithReferences(LoadMethod.LoadFrom, target.Location); var testAssembly = loader.LoadAssembly(LoadMethod.LoadFrom, tests.Location); // Grab the reflection wrapper. var testUtilReflectionWrapper = new TestUtilReflectionWrapper(loader); // If we have ignore targets, set up the appropriate test state recorder. if (this.ignoreTargets != null && this.ignoreTargets.Any()) { testUtilReflectionWrapper.InvokeStateRecorderPropertySet(this.BuildTestStateRecorder()); } // Execute the tests. foreach (var type in testAssembly.GetTypes()) { var testObj = Activator.CreateInstance(type); var method = type.GetMethods().First(x => x.Name.Equals(this.testMethodName)); method.Invoke(testObj, null); } // Execute Save by finding the loaded winbert assembly and calling TestUtil.SaveResults() var analysisLogPath = CreateAnalysisFilePath(target, tests); testUtilReflectionWrapper.InvokeSaveResults(analysisLogPath); result = TestRunResult.Successful(analysisLogPath, target); } catch (Exception) { result = TestRunResult.Failure(target); } return result; }