public void SeleniumGeneratorOptions_TryAddSameGenerators()
        {
            // initialize
            var options     = new SeleniumGeneratorOptions();
            var myGenerator = new MySeleniumGeneratorTestClass();

            // do
            options.AddCustomGenerator(myGenerator);
            options.AddCustomGenerator(myGenerator);

            // assert
            if (options.GetCustomGenerators().Count == 1)
            {
                Assert.AreEqual(myGenerator, options.GetCustomGenerators().First());
            }
            else
            {
                Assert.Fail();
            }
        }
        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_AddCustomGenerator()
        {
            // initialize
            var options     = new SeleniumGeneratorOptions();
            var myGenerator = new MySeleniumGeneratorTestClass();

            // do
            options.AddCustomGenerator(myGenerator);

            // assert
            var foundGenerator = options.GetCustomGenerators().FirstOrDefault(b => b.Equals(myGenerator));

            if (foundGenerator != null)
            {
                Assert.AreEqual(myGenerator, foundGenerator);
            }
            else
            {
                Assert.Fail();
            }
        }