Exemplo 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);
        }
        public void Should_Return_String_If_coords_is_not_null()
        {
            //Arrange
            //Act
            var result = GeoFenceHelper.CreateRangeCheckJsonBody(coords);

            //Assert
            Assert.NotNull(result);
            Assert.IsAssignableFrom <string>(result);
        }