示例#1
0
        private static void Main(string[] args)
        {
            _boligScraper = new Scraper();

            _userPreference     = GetUserPreference();
            _boligPortalRequest = new BoligPortalRequest
            {
                Amt           = ((int)_userPreference.Region).ToString(),
                RentMin       = "0",
                RentMax       = _userPreference.RentMax,
                ZipCodes      = _userPreference.ZipCodes,
                ApartmentType = _userPreference.ApartmentTypes,
                RentLength    = new List <string> {
                    "4"
                },
                Page     = "1",
                Limit    = "15",
                SortCol  = "3",
                SortDesc = "1"
            };

            Console.WriteLine("{0} :: Creating infinite loop\n", DateTime.Now);

            // infinite loop
            while (true)
            {
                Tick();

                Thread.Sleep(120000); // 2 minutes
            }
        }
示例#2
0
        public void CanCreateBoligPortalRequestAndDeserializeData()
        {
            // Arrange
            var boligPortalRequest = new BoligPortalRequest
                                         {
                                             Amt = ((int)RegionEnum.Aarhus).ToString(),
                                             RentMin = "0",
                                             RentMax = "10000",
                                             ZipCodes = new List<int> {8000, 8200},
                                             ApartmentType = new List<string> {"1", "2", "3", "4"},
                                             RentLength = new List<string> {"4"},
                                             Page = "1",
                                             Limit = "15",
                                             SortCol = "3",
                                             SortDesc = "1"
                                         };

            // Act
            IRestResponse restResponse = null;
            BoligPortalResponse boligPortalResponse = _boligScraper.Scrape(boligPortalRequest, out restResponse);

            // Assert
            Assert.That(restResponse, Is.Not.Null);
            Assert.That(boligPortalRequest, Is.Not.Null);
            Assert.That(boligPortalResponse.Properties.Count, Is.Not.EqualTo(0));
        }
示例#3
0
        private static void Main(string[] args)
        {
            _boligScraper = new Scraper();

            _userPreference = GetUserPreference();
            _boligPortalRequest = new BoligPortalRequest
                                      {
                                          Amt = ((int) _userPreference.Region).ToString(),
                                          RentMin = "0",
                                          RentMax = _userPreference.RentMax,
                                          ZipCodes = _userPreference.ZipCodes,
                                          ApartmentType = _userPreference.ApartmentTypes,
                                          RentLength = new List<string> {"4"},
                                          Page = "1",
                                          Limit = "15",
                                          SortCol = "3",
                                          SortDesc = "1"
                                      };

            Console.WriteLine("{0} :: Creating infinite loop\n", DateTime.Now);

            // infinite loop
            while (true)
            {
                Tick();

                Thread.Sleep(120000); // 2 minutes
            }
        }
        public void CanCreateBoligPortalRequestAndDeserializeData()
        {
            // Arrange
            var boligPortalRequest = new BoligPortalRequest
            {
                Amt      = ((int)RegionEnum.Aarhus).ToString(),
                RentMin  = "0",
                RentMax  = "10000",
                ZipCodes = new List <int> {
                    8000, 8200
                },
                ApartmentType = new List <string> {
                    "1", "2", "3", "4"
                },
                RentLength = new List <string> {
                    "4"
                },
                Page     = "1",
                Limit    = "15",
                SortCol  = "3",
                SortDesc = "1"
            };

            // Act
            IRestResponse       restResponse        = null;
            BoligPortalResponse boligPortalResponse = _boligScraper.Scrape(boligPortalRequest, out restResponse);

            // Assert
            Assert.That(restResponse, Is.Not.Null);
            Assert.That(boligPortalRequest, Is.Not.Null);
            Assert.That(boligPortalResponse.Properties.Count, Is.Not.EqualTo(0));
        }