Beispiel #1
0
        private (bool slots, ChromeDriver browser, string info) CheckStore(Store store)
        {
            Console.WriteLine($"{DateTime.Now:s} : Checking store {store.storeNumber} ({store.milesFromCenter:0.00} miles) {store.address} {store.city} {store.zipcode} with browser");

            var browser = browserCache.Pop();

            if (browser == null)
            {
                Console.WriteLine($"{DateTime.Now:s} : No browsers remaining to be able to check");
                return(true, null, "");
            }

            try
            {
                var slots = Checker.Check(store.zipcode, store.storeNumber.ToString(), riteAidData, browser);
                if (!slots.haveSlots)
                {
                    browserCache.Push(browser);
                    return(false, null, slots.info);
                }
                else
                {
                    browserCache.Hold(browser);
                    return(true, browser, slots.info);
                }
            }
            catch (Exception e)
            {
                Console.Beep(200, 500); // debug
                Console.Error.WriteLine(e.Message);
                Console.Error.WriteLine(e.StackTrace);
                browserCache.Push(browser);
                return(false, null, "exception");
            }
        }
        public void Test()
        {
            var data = new RiteAidData()
            {
                BirthDate  = "01/01/2000",
                City       = "Downingtown",
                StateName  = "Pennsylvania",
                Zip        = "19335",
                Condition  = ConditionType.WeakendImmuneSystem,
                Occupation = OccupationType.NoneOfTheAbove
            };

            var cache = new BrowserCache(5, data, Checker.Initializer, Checker.Resetter);

            var browser1 = cache.Pop();
            var browser2 = cache.Pop();

            cache.Push(browser1);

            browser1 = cache.Pop();
        }
Beispiel #3
0
        public void RiteAidCreate()
        {
            var data = new RiteAidData()
            {
                BirthDate  = "01/01/2000",
                City       = "Downingtown",
                StateCode  = "PA",
                StateName  = "Pennsylvania",
                Zip        = "19335",
                Condition  = ConditionType.WeakendImmuneSystem,
                Occupation = OccupationType.NoneOfTheAbove
            };

            var cache     = new BrowserCache(1, data, Checker.Initializer, Checker.Resetter);
            var browser   = cache.Pop();
            var available = Checker.Check("19406", "11158", data, browser);
        }