public TestExecutionManager(TestDetails details)
        {
            this.Details = details;
            this.RemoteCommands = new List<RemoteCommandViewModel>();

            foreach (var command in details.RemoteCommands)
            {
                this.RemoteCommands.Add(new RemoteCommandViewModel
                {
                    CommandName = command.Key.GetType().Name,
                    RemoteCommand = command.Key,
                    RemoteCommandArguments = command.Value
                });
            }

            // new test class so we can grab the proper provider
            FluentTest testClass = new FluentTest();
            this.Manager = testClass.I;
            if (details.Browsers.Count > 0)
            {
                var selectedBrowser = details.Browsers[0];
                this.Manager.Use(details.Browsers[0]);
            }
        }
        public static TestDetails GetRemoteCommands(RemoteTestRunDetails testSettings)
        {
            TestDetails testDetails = new TestDetails();
            testDetails.ShowInterface = testSettings.ShowInterface;
            Assembly asm = typeof(IRemoteCommand).Assembly;

            try
            {
                foreach (var command in testSettings.Commands)
                {
                    // attempt to locate mapper
                    // TODO: Get rid of the 'magic string' Commands part, make this work with loaded assemblies
                    var type = asm.GetType(string.Format("{0}.{1}.{2}", typeof(RemoteCommandManager).Namespace, "Commands", command.Name));
                    if (type == null)
                    {
                        throw new ArgumentException(string.Format("Unable to locate available command: {0}", command.Name));
                    }

                    CommandArgumentsTypeAttribute commandArgs = (CommandArgumentsTypeAttribute)type.GetCustomAttributes(typeof(CommandArgumentsTypeAttribute), false).FirstOrDefault();
                    if (commandArgs == null)
                    {
                        throw new ArgumentException(string.Format("Unable to locate command arguments handler for command: {0}", command.Name));
                    }

                    IRemoteCommand cmd = (IRemoteCommand)Activator.CreateInstance(type);
                    IRemoteCommandArguments args = null;
                    try
                    {
                        args = DeserializeArguments(commandArgs.ArgsType, command.Arguments);
                    }
                    catch (Exception ex)
                    {
                        throw new ArgumentException(string.Format("An error occurred while processing the arguments provided for command: {0}", command.Name), ex);
                    }

                    if (cmd.GetType() == typeof(Commands.Use))
                    {
                        var useArgs = (Commands.UseArguments)args;
                        Guard.ArgumentExpressionTrueForCommand<Commands.Use>(() => useArgs.BrowserType.Count > 0);

                        testDetails.Browsers.AddRange(useArgs.BrowserType);
                    }
                    else
                    {
                        testDetails.RemoteCommands.Add(cmd, args);
                    }
                }

                if (testDetails.Browsers.Count == 0)
                {
                    testDetails.Browsers.Add(BrowserType.Chrome);
                }
            }
            catch (FluentAutomation.API.Exceptions.AssertException)
            {
                throw;
            }
            catch (ArgumentException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred while executing the specified commands.", ex);
            }

            return testDetails;
        }