public void Scan_WorkingDirectorySet_ReturnsModulesOfThisAssembly() { // given var expectedTypes = GetCurrentAssemblyModules().ToArray(); Environment.CurrentDirectory = Path.GetDirectoryName(typeof(WorkingDirectoryScannerTests).Assembly.Location); // when var retval = _sut.ScanForMessageModules().ToArray(); // then Assert.That(retval, Is.EquivalentTo(expectedTypes)); }
/// <summary> /// Create the scanned types message modules instances. /// </summary> private void CreateModuleInstances() { // Ensure module creation is done only once for all threads. lock (_sync) { if (_modules == null) { _modules = new List <IMessageModule>(); IEnumerable <Type> moduleTypes = _scanner.ScanForMessageModules(); if (moduleTypes != null) { BuildModuleListAccordingToPreference(moduleTypes); } } } }