Пример #1
0
 public SearchScenario(WebDriverFactory driverFactory, ICredentials credentials, SearchTermProvider searchTermProvider, IConfiguration configuration)
 {
     _driverFactory      = driverFactory ?? throw new ArgumentNullException(nameof(driverFactory));
     _credentials        = credentials ?? throw new ArgumentNullException(nameof(credentials));
     _searchTermProvider = searchTermProvider ?? throw new ArgumentNullException(nameof(searchTermProvider));
     _configuration      = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }
Пример #2
0
        public async Task ShouldGetTerms()
        {
            // arrange
            var target = new SearchTermProvider();

            // act
            var actual = await target.GetTerms();

            // assert
            actual.Should().NotBeEmpty();
        }
Пример #3
0
        static async Task Main(string[] args)
        {
            try
            {
                Log.Info("Started");
                NLogConfiguration.Bootstrap();
                var configFactory = new ConfigurationFactory();
                var config        = configFactory.GetConfiguration(args);

                var driver = new DriverManager(config);

                var webDriverFactory = new WebDriverFactory(config, driver);

                if (config.Quiz)
                {
                    var rewardScenario = new RewardScenario(webDriverFactory, config);
                    await rewardScenario.DailyOffers();
                }

                if (config.Desktop || config.Mobile)
                {
                    var searchTermProvider = new SearchTermProvider();
                    var searchScenario     = new SearchScenario(webDriverFactory, config, searchTermProvider, config);
                    await searchScenario.DoSearches();
                }

                Log.Info("All Done");
            }
            catch (Exception e)
            {
                Log.Error(e);
            }

            // wait for user to acknowledge
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
        }