Esempio n. 1
0
        private async Task <List <DealDTO> > CheckConsumerIsInRange()
        {
            List <DealDTO> ConsumerDeals = new List <DealDTO>();

            var consumerBuffer = await GenerateGeoBufferQuery.GenerateBuffer(UserFilters.Range * 1000, UserFilters.Location);



            var queryBody = GeoFenceHelper.CreateRangeCheckJsonBody(consumerBuffer);

            foreach (FilterDeal filterDeal in _filteredDeals)
            {
                var val = GeoFenceHelper.FindRange(queryBody, filterDeal);
                if (val == 0)
                {
                    continue;
                }
                Deal    temp = _deals.First(d => d.Id.Equals(filterDeal.DealId));
                DealDTO deal = new DealDTO
                {
                    DealTitle       = temp.Title,
                    DealDescription = temp.Description,
                    BusinessName    = temp.Business.Name,
                    Latitude        = temp.Business.Location.Latitude,
                    Longitude       = temp.Business.Location.Longitude
                };

                ConsumerDeals.Add(deal);
            }


            return(ConsumerDeals);
        }
Esempio n. 2
0
        public async void Should_Return_Buffer_Coordinate_List(int range, double latitude, double longitude)
        {
            //act
            var result = await GenerateGeoBufferQuery.GenerateBuffer(
                range,
                new LocationDTO()
            {
                Latitude  = latitude,
                Longitude = longitude
            }
                );

            //Assert
            Assert.NotNull(result);
            Assert.IsAssignableFrom <List <List <double> > >(result);
        }
Esempio n. 3
0
        public async void Should_return_null_On_Bad_Data(int range, double latitude, double longitude)
        {
            //act

            var result = await Record.ExceptionAsync(() => GenerateGeoBufferQuery.GenerateBuffer(
                                                         range,
                                                         new LocationDTO()
            {
                Latitude  = latitude,
                Longitude = longitude
            }
                                                         ));

            //Assert

            Assert.Null(result);
        }