// Try to load the assembly and, if successful, populate
// the list of all loaded assemblies. As a side effect
// of calling TestConverter.ConvertTestCase, the converter's
// cache of all test cases is populated as well. All
// future calls to convert a test case may now use the cache.
private bool TryLoadAssembly()
{
var package = NUnitTestAdapter.CreateTestPackage(assemblyName);
if (!runner.Load(package))
{
return(false);
}
logger.SendMessage(TestMessageLevel.Informational, string.Format("Loading tests from {0}", package.FullName));
AddTestCases(runner.Test);
if (tfsFilter == null || !tfsFilter.HasTfsFilterValue)
{
return(true);
}
var filteredTestCases = tfsFilter.CheckFilter(LoadedTestCases);
var ptestCases = filteredTestCases as TestCase[] ?? filteredTestCases.ToArray();
logger.SendMessage(TestMessageLevel.Informational, string.Format("TFS Filter detected: LoadedTestCases {0}, Filterered Test Cases {1}", LoadedTestCases.Count, ptestCases.Count()));
nunitFilter = MakeTestFilter(ptestCases);
return(true);
}