private static Dictionary <Type, ISeleniumGenerator> GetControlGenerators(SeleniumGeneratorOptions options) { var customGenerators = options.GetCustomGenerators().ToDictionary(t => t.ControlType, t => t); var discoveredGenerators = options.GetAssemblies() .SelectMany(a => a.GetLoadableTypes()) .Where(t => typeof(ISeleniumGenerator).IsAssignableFrom(t) && !t.IsAbstract) .Select(t => (ISeleniumGenerator)Activator.CreateInstance(t)) .ToDictionary(t => t.ControlType, t => t); return(customGenerators.AddRange(discoveredGenerators)); }
public void SeleniumGeneratorOptions_AddAssembly() { // initialize var options = new SeleniumGeneratorOptions(); var myAssembly = new MySeleniumGeneratorTestClass().GetType().Assembly; // do options.AddAssembly(myAssembly); // assert var foundAssembly = options.GetAssemblies().FirstOrDefault(b => b.Equals(myAssembly)); if (foundAssembly != null) { Assert.AreEqual(myAssembly, foundAssembly); } else { Assert.Fail(); } }