public InvokerHelper(string url, string label, int browserWidth, int browserHeight, TResult defaultValue, BrowserOperation <TResult> operation) { this.result = defaultValue; this.browserHeight = browserHeight; this.operation = operation; this.url = url; this.label = label; this.browserWidth = browserWidth; }
public void Initialize() { actionCenter = new Mock <IActionCenter>(); application = new Mock <IApplication>(); logger = new Mock <ILogger>(); taskbar = new Mock <ITaskbar>(); uiFactory = new Mock <IUserInterfaceFactory>(); sut = new BrowserOperation(actionCenter.Object, application.Object, logger.Object, taskbar.Object, uiFactory.Object); }
private IOperation BuildBrowserOperation() { var fileSystemDialog = BuildFileSystemDialog(); var moduleLogger = ModuleLogger(nameof(BrowserApplication)); var browser = new BrowserApplication(context.AppConfig, context.Settings.Browser, fileSystemDialog, messageBox, moduleLogger, text, uiFactory); var operation = new BrowserOperation(actionCenter, context, logger, taskbar, taskview, uiFactory); context.Browser = browser; return(operation); }
private IOperation BuildBrowserOperation() { var moduleLogger = new ModuleLogger(logger, nameof(BrowserApplication)); var browser = new BrowserApplication(configuration.AppConfig, configuration.Settings.Browser, messageBox, moduleLogger, text, uiFactory); var browserInfo = new BrowserApplicationInfo(); var operation = new BrowserOperation(actionCenter, browser, logger, taskbar, uiFactory); this.browser = browser; return(operation); }
public void Initialize() { actionCenter = new Mock <IActionCenter>(); browser = new Mock <IBrowserApplication>(); context = new ClientContext(); logger = new Mock <ILogger>(); settings = new AppSettings(); taskbar = new Mock <ITaskbar>(); taskview = new Mock <ITaskview>(); uiFactory = new Mock <IUserInterfaceFactory>(); context.Browser = browser.Object; context.Settings = settings; sut = new BrowserOperation(actionCenter.Object, context, logger.Object, taskbar.Object, taskview.Object, uiFactory.Object); }
/// <summary> /// This method will create a new thread, make a hidden form and a browser /// control on that thread, navigate the browser to the URL you give it, /// wait for OnDocumentComplete, and then execute the operation you give it. /// </summary> /// <typeparam name="TResult">The type of the result</typeparam> /// <param name="url">The URL to navigate the browser to</param> /// <param name="label">The name to assign to the background thread (for easier debugging)</param> /// <param name="browserWidth">The approx. desired width of the browser</param> /// <param name="browserHeight">The approx. desired height of the browser</param> /// <param name="defaultValue">The value to return if the operation is not successful</param> /// <param name="operation">The operation to perform</param> /// <returns>The result returned by the operation, or if failed, defaultValue</returns> public static TResult InvokeAfterDocumentComplete <TResult>(string url, string label, int browserWidth, int browserHeight, TResult defaultValue, BrowserOperation <TResult> operation) { InvokerHelper <TResult> invoker = new InvokerHelper <TResult>(url, label, browserWidth, browserHeight, defaultValue, operation); invoker.Execute(); return(invoker.Result); }