public PDVServiceTest()
        {
            var databaseContext = new DatabaseContext();

            var pdvRepository = new PDVRepository(databaseContext);

            pdvService = new PDVService(pdvRepository);
        }
        public async Task Add()
        {
            var repository = new PDVRepository(new Data.DatabaseContext());

            var document = Guid.NewGuid().ToString();

            var coverageArea = GeoJSONFactory.NewMultiPolygon(new double[, ] {
                { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }
            });
            var address = GeoJSONFactory.NewPoint(0, 0);

            var pdv = new PDV("1", new LegalPeople("foo", "bar", document, new NaturalPeople("xyz")), coverageArea, address);

            await repository.Add(pdv);
        }
Ejemplo n.º 3
0
        public VendaModel RegistrarVenda(double valorPagar, double valorPago)
        {
            try
            {
                PDVBusiness   business   = new PDVBusiness();
                PDVRepository repository = new PDVRepository(this.context);
                VendaModel    venda      = business.DarTroco(valorPagar, valorPago);

                if (venda != null)
                {
                    repository.Insert(venda);
                }

                return(venda);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task Search_Intersects()
        {
            var repository = new PDVRepository(new Data.DatabaseContext());

            var coverageArea = new GeoJsonMultiPolygon <GeoJson2DCoordinates>
                               (
                new GeoJsonMultiPolygonCoordinates <GeoJson2DCoordinates>
                (
                    new GeoJsonPolygonCoordinates <GeoJson2DCoordinates>[]
            {
                new GeoJsonPolygonCoordinates <GeoJson2DCoordinates>
                (
                    new GeoJsonLinearRingCoordinates <GeoJson2DCoordinates>
                    (
                        new GeoJson2DCoordinates[]
                {
                    new GeoJson2DCoordinates(-46.944580078125, -23.51362636346272),
                    new GeoJson2DCoordinates(-46.8841552734375, -23.74009762440226),
                    new GeoJson2DCoordinates(-46.4996337890625, -23.810475327766568),
                    new GeoJson2DCoordinates(-46.219482421875, -23.55391651832161),
                    new GeoJson2DCoordinates(-46.59301757812499, -23.301901124188877),
                    new GeoJson2DCoordinates(-46.944580078125, -23.51362636346272)
                }
                    )
                )
            }
                )
                               );

            var adrress = new GeoJsonPoint <GeoJson2DCoordinates>(new GeoJson2DCoordinates(0, 0));

            var document = Guid.NewGuid().ToString();

            var pdv = new PDV("1", new LegalPeople("foo", "bar", document, new NaturalPeople("xyz")), coverageArea, adrress);

            await repository.Add(pdv);

            var ret = await repository.Search(-46.65893554687499, -23.54384513650583);

            Assert.IsNotNull(ret.Where(p => p.Id == pdv.Id));
        }