Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Navigator"/> class.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="scheme">The URI scheme.</param>
        /// <param name="routes">The routes.</param>
        /// <param name="navigationService">The navigation service.</param>
        public Navigator(INavigatorFactory parent, string scheme, IRouteResolver routes, Func<INavigationService> navigationService)
            : base(navigationService)
        {
            Guard.ArgumentNotNull(parent, "root");
            Guard.ArgumentNotNull(routes, "routes");
            Guard.ArgumentNotNull(navigationService, "navigationService");

            _parent = parent;
            _scheme = scheme;
            _routes = routes;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Navigator"/> class.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="scheme">The URI scheme.</param>
        /// <param name="routes">The routes.</param>
        /// <param name="navigationService">The navigation service.</param>
        public Navigator(INavigatorFactory parent, string scheme, IRouteResolver routes, Func <INavigationService> navigationService)
            : base(navigationService)
        {
            Guard.ArgumentNotNull(parent, "root");
            Guard.ArgumentNotNull(routes, "routes");
            Guard.ArgumentNotNull(navigationService, "navigationService");

            _parent = parent;
            _scheme = scheme;
            _routes = routes;
        }
Exemple #3
0
        internal Scraper(string baseUrl, INavigatorFactory navigatorFactory)
        {
            if (string.IsNullOrWhiteSpace(baseUrl))
            {
                throw new ArgumentException("message", nameof(baseUrl));
            }

            BaseUrl           = baseUrl;
            mNavigatorFactory = navigatorFactory;
            mHtmlWeb          = new HtmlWeb();
        }
Exemple #4
0
        public void SetUp()
        {
            HtmlDocument htmlDoc = new HtmlDocument();

            htmlDoc.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"HTML\cl-apa-listing.html"));
            mNavigator = htmlDoc.CreateNavigator();

            mNavigatorFactory = Substitute.For <INavigatorFactory>();
            mNavigatorFactory.Create(BaseUrl, Arg.Any <HttpClient>(), Arg.Any <HtmlWeb>()).Returns(mNavigator);

            mSut = new Scraper(BaseUrl, mNavigatorFactory);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Navigator"/> class.
        /// </summary>
        /// <param name="factory">The factory that created this navigator.</param>
        /// <param name="parent">The parent navigator (can be null).</param>
        /// <param name="scheme">The URI scheme.</param>
        /// <param name="routes">The routes.</param>
        /// <param name="navigationService">The navigation service.</param>
        public Navigator(INavigatorFactory factory, INavigator parent, string scheme, IRouteResolver routes, Func <INavigationService> navigationService)
            : base(navigationService)
        {
            Guard.ArgumentNotNull(factory, "root");
            Guard.ArgumentNotNull(routes, "routes");
            Guard.ArgumentNotNull(navigationService, "navigationService");

            this.factory = factory;
            this.parent  = parent;
            this.scheme  = scheme;
            this.routes  = routes;
        }
Exemple #6
0
    	/// <summary>
    	/// Initializes a new instance of the <see cref="Navigator"/> class.
    	/// </summary>
    	/// <param name="factory">The factory that created this navigator.</param>
    	/// <param name="parent">The parent navigator (can be null).</param>
    	/// <param name="scheme">The URI scheme.</param>
    	/// <param name="routes">The routes.</param>
    	/// <param name="navigationService">The navigation service.</param>
    	public Navigator(INavigatorFactory factory, INavigator parent, string scheme, IRouteResolver routes, Func<INavigationService> navigationService)
            : base(navigationService)
        {
            Guard.ArgumentNotNull(factory, "root");
            Guard.ArgumentNotNull(routes, "routes");
            Guard.ArgumentNotNull(navigationService, "navigationService");

            this.factory = factory;
			this.parent = parent;
            this.scheme = scheme;
            this.routes = routes;
        }
Exemple #7
0
        public void SetUp()
        {
            HtmlDocument targetHtmlDoc = new HtmlDocument();

            targetHtmlDoc.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"HTML\cl-apa-listing.html"));
            XPathNavigator targetNav = targetHtmlDoc.CreateNavigator();

            HtmlDocument searchHtmlDoc = new HtmlDocument();

            searchHtmlDoc.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"HTML\cl-apa-search-page.html"));
            XPathNavigator searchNav = searchHtmlDoc.CreateNavigator();

            INavigatorFactory navigatorFactory = Substitute.For <INavigatorFactory>();

            navigatorFactory.Create(BaseUrl + ResultsStartPage, Arg.Any <HttpClient>(), Arg.Any <HtmlWeb>()).Returns(searchNav);
            //For all other urls, return target page
            navigatorFactory.Create(Arg.Is <string>(url => url != BaseUrl + ResultsStartPage), Arg.Any <HttpClient>(), Arg.Any <HtmlWeb>()).Returns(targetNav);

            mSut = new PaginatingScraper(BaseUrl, navigatorFactory);
        }
        public MainWindow(INavigatorFactory navigation)
        {
            InitializeComponent();

            MainNavigator = navigation.CreateNavigator(MainFrame);
        }
        public MainWindow(INavigatorFactory navigation)
        {
            InitializeComponent();

            MainNavigator = navigation.CreateNavigator(MainFrame);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="factory"></param>
 public NavigatorPluginContext(INavigatorFactory factory)
 {
     Factory = factory;
 }
Exemple #11
0
 internal PaginatingScraper(string baseUrl, INavigatorFactory navigatorFactory)
     : base(baseUrl, navigatorFactory)
 {
 }