Exemple #1
0
        private void InsertFakeCustomer()
        {
            var customer = new Customer(
                cnpj: "95098349000114",
                companyName: "Tânia e Aurora Corretores Associados ME",
                opening: DateTime.Parse("03/04/2016"),
                phone: "(11) 3844-7566",
                municipalRegistration: string.Empty,
                stateRegistration: "553.178.021.386",
                email: "*****@*****.**"
                );

            var address1 = new Address(
                description: "Escritório",
                zipCode: "02123044",
                type: AddressType.Billing,
                street: "Travessa Gaspar Raposo",
                neighborhood: "Jardim Japão",
                number: 300,
                city: "São Paulo",
                state: "SP",
                customerId: customer.Id);

            address1.SetCodeCity("3550308");

            var address2 = new Address(
                description: "Balcão Principal",
                zipCode: "01033-000",
                type: AddressType.Delivery,
                street: "Avenida Cásper Líbero",
                neighborhood: "Centro",
                number: 324,
                city: "São Paulo",
                state: "SP",
                customerId: customer.Id);

            address2.SetCodeCity("3550308");

            var address3 = new Address(
                description: "Depósito Devolução",
                zipCode: "18046-430",
                type: AddressType.Other,
                street: "Rua Elysio de Oliveira",
                neighborhood: "Jardim São Carlos",
                number: 329,
                city: "Sorocaba",
                state: "SP",
                customerId: customer.Id);

            address3.SetCodeCity("3552205");

            customer.AddAddress(address1);
            customer.AddAddress(address2);
            customer.AddAddress(address3);

            _fakeContext.Customers.Add(customer);
        }
        public async Task when_updated_customer_it_should_be_updated_correctly_in_the_db()
        {
            ICustomerRepository _customerRepository = new CustomerRepository(_dbContextConfig.CompanyContext);

            var customer1 = new Customer("Justyna", "Stanczyk", "+48662622117");

            customer1.AddAddress(new CustomerAddress("190", "108", "Wadowica", "Kraków", "31-416"));
            var customer2 = new Customer("Karol", "Cichon", "+48504400336");

            customer2.AddAddress(new CustomerAddress("117", "06", "Krakowska", "Limanowa", "31-416"));
            await _customerRepository.AddAsync(customer1);

            await _customerRepository.AddAsync(customer2);

            var existingCustomer = await _customerRepository.GetByPhoneNumberAsync(customer1.TelephoneNumber);

            var existingCustomerWithAddress = await _customerRepository.GetWithAddressAsync(existingCustomer.Id);

            existingCustomerWithAddress.Update(existingCustomerWithAddress.Name, "Cichon", existingCustomerWithAddress.TelephoneNumber);
            existingCustomerWithAddress.CustomerAddress.Update("27", "28", "Krakowska", "Kraków", existingCustomerWithAddress.CustomerAddress.ZipCode);
            // // await _customerRepository.UpdateAsync (existingCustomerWithAddress);
            // var updatedCustomerWithAddress = await _customerRepository.GetWithAddressAsync (existingCustomerWithAddress.Id);
            // // Assert.Equal (existingCustomerWithAddress, updatedCustomerWithAddress);
            // Assert.Equal (customer2, existingCustomerWithAddress);
            customer1.ShouldBeEquivalentTo(existingCustomer);
        }
        public void TestMethod1()
        {
            var name     = new Name("Capitão", "América");
            var email    = new Email("*****@*****.**");
            var document = new Document("123123213");
            var address  = new Address("123A", "091800", "New York", "NY", EAddressType.Shipping);
            var customer = new Customer(name, document, email);

            customer.AddAddress(address);

            var mouse      = new Product("Mouse Logitech", "Excelente mouse", "base64", 25, 10);
            var teclado    = new Product("Teclado windows", "Excelente Teclado", "base64", 253, 15);
            var impressora = new Product("Impressora HP", "Excelente Impressora", "base64", 100, 100);

            var order = new Order(customer);

            // order.AddItem(new OrderItem(mouse, 5));
            // order.AddItem(new OrderItem(teclado, 10));
            // order.AddItem(new OrderItem(impressora, 15));

            //Realiza o pedido
            order.Place();

            var valid = order.Valid;

            //Paga o pedido
            order.Pay();

            //Envia o pedido
            order.Ship();

            //Cancela o pedido
            order.Cancel();
            Assert.IsTrue(true);
        }
Exemple #4
0
        public async Task CreateAsync(string name, string surname, string phoneNumber, string flatNumber, string buildingNumber, string street, string city, string zipCode)
        {
            var customer = new Customer(name, surname, phoneNumber);

            customer.AddAddress(new CustomerAddress(flatNumber, buildingNumber, street, city, zipCode));
            await _customerRepository.AddAsync(customer);
        }
Exemple #5
0
        public void ShouldContainsAAddressWhenAddAddressIsCalledWithValidAddress()
        {
            var address = new Address(
                "Street Y",
                "100",
                "",
                "Brooklin",
                "New York",
                "New York",
                "USA",
                "10400",
                EAddressType.Shipping);

            _steve.AddAddress(address);

            Assert.Equal(1, _steve.Addresses.Count);
        }
        public void NullAddressIsIgnored()
        {
            Customer c = Om.CreateCustomer();

            c.AddAddress(null);

            Assert.That(c.Addresses, Is.Empty);
        }
        public void DeleteMeToo()
        {
            var ctx  = new BaltaDataContext();
            var repo = new CustomerRepository(ctx);

            // Recupera os produtos do banco
            var name     = new Name("André", "Baltieri");
            var document = new Document("46718115533");
            var email    = new Email("*****@*****.**");
            var customer = new Customer(name, document, email, "551999876542");
            var address  = new Address("Rua", "1", "N/A", "Meu Bairro", "Piracicaba", "SP", "BR", "13400000", EAddressType.Billing);
            var address2 = new Address("Rua2", "2", "N/A", "Meu Bairro", "Piracicaba", "SP", "BR", "13400000", EAddressType.Shipping);

            customer.AddAddress(address);
            customer.AddAddress(address2);

            repo.Save(customer);
        }
        public void AddingAddressTakesCareOfBidirectionalAssociation()
        {
            Customer c = Om.CreateCustomer();

            Address a = Om.CreateAddress();

            c.AddAddress(a);

            Assert.That(c.Addresses, Is.EqualTo(new[] { a }));
        }
Exemple #9
0
        public void Can_not_add_duplicate_addresses()
        {
            var customer = new Customer();
            var address  = new Address {
                Id = 1
            };
            var address2 = new Address {
                Id = 2
            };

            customer.AddAddress(address);
            customer.AddAddress(address); // should not add
            customer.AddAddress(address2);


            customer.Addresses.Count.ShouldEqual(2);
            var addresses = customer.Addresses.ToList();

            addresses[0].Id.ShouldEqual(1);
            addresses[1].Id.ShouldEqual(2);
        }
        public async Task when_adding_new_customer_it_should_be_added_correctly_to_the_db()
        {
            ICustomerRepository _customerRepository = new CustomerRepository(_dbContextConfig.CompanyContext);
            var customer = new Customer("Karol", "Cichon", "+48504400336");

            customer.AddAddress(new CustomerAddress("27", "28", "Krakowska", "Kraków", "31-416"));
            await _customerRepository.AddAsync(customer);

            var existingCustomer = await _customerRepository.GetByPhoneNumberAsync(customer.TelephoneNumber);

            Assert.Equal(customer, existingCustomer);
        }
Exemple #11
0
        public void Can_add_address()
        {
            var customer = new Customer();
            var address  = new Address {
                Id = 1
            };

            customer.AddAddress(address);

            customer.Addresses.Count.ShouldEqual(1);
            customer.Addresses.First().Id.ShouldEqual(1);
        }
Exemple #12
0
        public ICommandResult Handle(CreateCustomerCommand Command)
        {
            //verificar se o email já existe no bd
            if (_customer.CheckDocument(Command.Document))
            {
                AddNotification("Document", "Este documento já está cadastrado");
            }
            //verificar se o email já existe no bd
            if (_customer.CheckEmail(Command.Email))
            {
                AddNotification("Email", "Este email já está cadastrado em nossa base de dados");
            }
            //criar vos
            var name     = new Name(Command.FirstName, Command.LastName);
            var document = new Document(Command.Document);
            var email    = new Email(Command.Email);

            // criar entidade
            var customer = new Customer(name, document, email, Command.Phone);

            if (Command.Addresses.Count() > 0)
            {
                foreach (var item in Command.Addresses)
                {
                    var address = new Address(item.Street, item.Number, item.Complement, item.District, item.City, item.State, item.Country, item.ZipCode, item.AddressType);
                    customer.AddAddress(address);
                }
            }


            //validar entidades vos
            AddNotifications(name.Notifications);
            AddNotifications(document.Notifications);
            AddNotifications(email.Notifications);
            AddNotifications(customer.Notifications);

            if (Invalid)
            {
                return(new CustomerResult(false, "Erro nos campos Iformados", Notifications));
            }
            ;

            //persistir o cliente
            _customer.Save(customer);

            //enviar email boas vindas
            _email.Send(Command.Email, "teste@teste", "Bem vindo", "mensagem de boas vindas");

            // retornar o resultado

            return(new CustomerResult(true, "Cadastro realizado com sucesso", new { Name = customer.Name.ToString(), Id = customer.Id, Email = customer.Email.Address }));
        }
Exemple #13
0
        public async Task <APIGatewayProxyResponse> Execute(
            APIGatewayProxyRequest request,
            ILambdaContext context)
        {
            var customerDto = JsonConvert.DeserializeObject <CreateCustomerDTO>(request.Body);

            try
            {
                var customer = new Customer()
                {
                    EmailAddress = customerDto.EmailAddress,
                    FirstName    = customerDto.FirstName,
                    LastName     = customerDto.LastName,
                    Username     = customerDto.Username
                };

                customer.AddAddress(
                    customerDto.AddressName,
                    customerDto.AddressLine1,
                    customerDto.Town,
                    customerDto.Postcode,
                    customerDto.Country);

                var created = await this._customerRepository.CreateAsync(customer).ConfigureAwait(false);

                if (created != null)
                {
                    return(new APIGatewayProxyResponse
                    {
                        StatusCode = 200,
                        Body = JsonConvert.SerializeObject(new ApiResponse <Customer>(created))
                    });
                }
                else
                {
                    return(new APIGatewayProxyResponse
                    {
                        StatusCode = 400,
                        Body = JsonConvert.SerializeObject(new ApiResponse <Customer>(null, "Unhandled failure"))
                    });
                }
            }
            catch (CustomerExistsException)
            {
                return(new APIGatewayProxyResponse
                {
                    StatusCode = 400,
                    Body = JsonConvert.SerializeObject(new ApiResponse <Customer>(null, "Customer already exists"))
                });
            }
        }
Exemple #14
0
        public void AddAddress()
        {
            CreateCustomer();
            var dto = new AddressDto
            {
                CustomerId = CustomerInstance.Id,
                Street     = "101 Thames Street",
                City       = "Dublin",
                PostCode   = "16",
                Country    = "Ireland"
            };

            var address = CustomerInstance.AddAddress(RepositoryLocator, dto);

            Assert.AreEqual(1, CustomerInstance.Addresses().Count, "Incorrect number of addresses were found at the customer");
        }
Exemple #15
0
        public void Can_remove_address_assigned_as_billing_address()
        {
            var customer = new Customer();
            var address  = new Address {
                Id = 1
            };

            customer.AddAddress(address);
            customer.SetBillingAddress(address);

            customer.BillingAddress.ShouldBeTheSameAs(customer.Addresses.First());

            customer.RemoveAddress(address);
            customer.Addresses.Count.ShouldEqual(0);
            customer.BillingAddress.ShouldBeNull();
        }
Exemple #16
0
        public DeliveryAddressAddResponse AddDeliveryAddress(DeliveryAddressAddRequest request)
        {
            DeliveryAddressAddResponse response = new DeliveryAddressAddResponse();
            Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken);

            Address address = ConvertToAddress(request.Address);

            customer.AddAddress(address, request.Address.Name);

            _customerRepository.Save(customer);
            _uow.Commit();

            //response.DeliveryAddress = deliveryAddress.ConvertToDeliveryAddressView();

            return(response);
        }
        public ICommandResult Handle(CreateCustomerRequest request)
        {
            if (!request.IsValid)
            {
                AddNotifications(request.Notifications);
                return(new GenericCommandResult(false, "Requisição inválida!", request.Notifications));
            }

            var facebookUrl  = new Url(request.FacebookUrl);
            var linkedinUrl  = new Url(request.LinkedinUrl);
            var twitterUrl   = new Url(request.TwitterUrl);
            var instagramUrl = new Url(request.InstagramUrl);

            var cpf = new Cpf(request.Cpf);

            var customer = new Customer(request.Name, request.BirthDate, facebookUrl, linkedinUrl, twitterUrl, instagramUrl, cpf, request.Rg);

            foreach (var requestPhoneNumber in request.PhoneNumbers)
            {
                var phoneNumber = new PhoneNumber(requestPhoneNumber.Number, requestPhoneNumber.Identification, customer.Id);
                customer.AddPhoneNumber(phoneNumber);
                AddNotifications(phoneNumber.Notifications);
            }

            foreach (var requestAddress in request.Adresses)
            {
                var address = new Address(requestAddress.Street, requestAddress.Number, requestAddress.Neighborhood, requestAddress.City, requestAddress.State, requestAddress.Country, requestAddress.ZipCode, requestAddress.Identification, customer.Id);
                customer.AddAddress(address);
                AddNotifications(address.Notifications);
            }

            AddNotifications(facebookUrl.Notifications);
            AddNotifications(linkedinUrl.Notifications);
            AddNotifications(twitterUrl.Notifications);
            AddNotifications(instagramUrl.Notifications);
            AddNotifications(cpf.Notifications);
            AddNotifications(customer.Notifications);

            if (!IsValid)
            {
                return(new GenericCommandResult(IsValid, "Erro ao criar cliente!", Notifications));
            }

            _repository.Create(customer);

            return(new GenericCommandResult(IsValid, "Cliente criado!", Notifications));
        }
Exemple #18
0
        public DeliveryAddressAddResponse AddDeliveryAddress(DeliveryAddressAddRequest request)
        {
            DeliveryAddressAddResponse response = new DeliveryAddressAddResponse();
            Customer        customer            = _customerRepository.FindBy(request.CustomerEmail);
            DeliveryAddress deliveryAddress     = new DeliveryAddress();

            deliveryAddress.Customer = customer;

            UpdateDeliveryAddressFrom(request.Address, deliveryAddress);
            customer.AddAddress(deliveryAddress);
            _customerRepository.Save(customer);
            _uow.Commit();

            response.DeliveryAddress = _mapper.Map <DeliveryAddress, DeliveryAddressView>(deliveryAddress);

            return(response);
        }
        public async Task added_customer_should_be_removed_correctly_in_the_db()
        {
            ICustomerRepository _customerRepository = new CustomerRepository(_dbContextConfig.CompanyContext);

            var customer = new Customer("Jan", "Kowalski", "+48123456789");

            customer.AddAddress(new CustomerAddress("1", "2", "Krotka", "Kraków", "31-416"));

            await _customerRepository.AddAsync(customer);

            var existingCustomer = await _customerRepository.GetByPhoneNumberAsync(customer.TelephoneNumber);

            await _customerRepository.DeleteAsync(existingCustomer);

            var removedCustomer = await _customerRepository.GetAsync(existingCustomer.Id);

            Assert.Equal(null, removedCustomer);
        }
Exemple #20
0
        public ICommandResult Handle(UpdateCustomerCommand Command)
        {
            //criar vos
            var name     = new Name(Command.FirstName, Command.LastName);
            var document = new Document(Command.Document);
            var email    = new Email(Command.Email);

            // criar entidade
            var customer = new Customer(Command.Customer, name, document, email, Command.Phone);

            if (Command.Addresses.Count() > 0)
            {
                _customer.RemoveAddressesCustomer(Command.Customer);
                var addressSends = Command.Addresses.ToList();

                foreach (var item in addressSends)
                {
                    var address = new Address(item.Street, item.Number, item.Complement, item.District, item.City, item.State, item.Country, item.ZipCode, item.AddressType);
                    customer.AddAddress(address);
                }
            }


            //validar entidades vos
            AddNotifications(name.Notifications);
            AddNotifications(document.Notifications);
            AddNotifications(email.Notifications);
            AddNotifications(customer.Notifications);

            if (Invalid)
            {
                return(new CustomerResult(false, "Erro nos campos Iformados", Notifications));
            }

            //persistir o cliente
            _customer.Update(customer);

            //enviar email boas vindas
            _email.Send(Command.Email, "teste@teste", "Bem vindo", "mensagem de boas vindas");

            // retornar o resultado

            return(new CustomerResult(true, "Cadastro atualizado com sucesso", new { Name = customer.Name.ToString(), Id = customer.Id, Email = customer.Email.Address }));
        }
        /// <inheritdoc />
        public async Task <Customer> RetrieveAsync(
            string emailAddress)
        {
            var customer = new Customer()
            {
                EmailAddress = emailAddress
            };

            var getItemRequest = new GetItemRequest()
            {
                TableName = DynamoDbConstants.TableName, Key = customer.GetKeys()
            };

            var getResult = await this._client.GetItemAsync(getItemRequest).ConfigureAwait(false);

            if (getResult.Item != null)
            {
                var customerData = getResult.Item.FirstOrDefault(p => p.Key == "Data");

                var addressDetails = customerData.Value.M.FirstOrDefault(p => p.Key == "addresses");

                customerData.Value.M.Remove("addresses");

                customer = JsonConvert.DeserializeObject <Customer>(Document.FromAttributeMap(customerData.Value.M).ToJson());

                foreach (var address in addressDetails.Value.M)
                {
                    customer.AddAddress(
                        address.Key,
                        address.Value.M["AddressLine1"].S,
                        address.Value.M["Town"].S,
                        address.Value.M["Postcode"].S,
                        address.Value.M["CountryCode"].S);
                }

                return(customer);
            }
            else
            {
                this._logger.LogWarning($"Customer search executed but not found {emailAddress}");

                throw new CustomerNotFoundException("Customer not found");
            }
        }
Exemple #22
0
        public DeliveryAddressAddResponse AddDeliveryAddress(DeliveryAddressAddRequest request)
        {
            DeliveryAddressAddResponse response = new DeliveryAddressAddResponse();
            Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken);

            DeliveryAddress deliveryAddress = new DeliveryAddress();

            deliveryAddress.Customer = customer;
            UpdateDeliveryAddressFrom(request.Address, deliveryAddress);

            customer.AddAddress(deliveryAddress);

            _customerRepository.Save(customer);
            _uow.Commit();

            response.DeliveryAddress = deliveryAddress.ConvertToDeliveryAddressView();

            return(response);
        }
Exemple #23
0
        private void CreateCustomer()
        {
            Customer customer =
                new Customer
            {
                FirstName = "Raffaele",
                LastName  = "Garofalo",
                Title     = "Mr.",
                BirthDate = new DateTime(1978, 06, 12),
            };
            Contact email =
                new Contact
            {
                ContactType = ContactType.Email,
                Name        = "E-mail",
                Number      = "*****@*****.**",
                Description = "E-mail address",
                IsDefault   = true
            };

            customer.AddContact(email);
            Address address =
                new Address
            {
                AddressLine1 = "4 Henry Vale",
                City         = "Warwick",
                Country      = "Bermuda",
                IsDefault    = true,
                State        = "Bermuda",
                Town         = "Warwick",
                ZipCode      = "PG01"
            };

            customer.AddAddress(address);
            ISessionFactory factory    = new SessionFactory();
            IUnitOfWork     unitOfWork = factory.CurrentUoW;
            IRepository     repository = new Repository(unitOfWork);

            unitOfWork.BeginTransaction();
            repository.AddEntity(customer);
            unitOfWork.CommitTransaction();
        }
Exemple #24
0
        public Customer CreateCustomerWithAdressesAndContacts(object createCompleteCustomerViewModel, ref bool hasConflit)
        {
            var    model = (CreateCompleteCustomerViewModel)createCompleteCustomerViewModel;
            string cnpj  = model.Cnpj.CleanCnpjToSaveDataBase();

            var customer =
                new Customer(
                    cnpj: cnpj,
                    companyName: model.CompanyName,
                    opening: DateTime.Parse(model.Opening).Date,
                    phone: model.Phone,
                    municipalRegistration: model.MunicipalRegistration,
                    stateRegistration: model.StateRegistration,
                    email: model.Email);

            if (!customer.Valid)
            {
                return(customer);
            }

            if (_customerRepository.HasAnotherCustomerWithThisCnpj(customer.Cnpj))
            {
                hasConflit = true;
                return(customer);
            }

            foreach (var line in model.Adresses)
            {
                var address =
                    new Address(
                        description: line.Description,
                        zipCode: line.ZipCode,
                        type: (AddressType)line.Type,
                        street: line.Street,
                        neighborhood: line.Neighborhood,
                        number: line.Number,
                        city: line.City,
                        state: line.State,
                        customerId: customer.Id);

                if (!address.Valid)
                {
                    customer.AddNotification(address.GetAllNotifications());
                    return(customer);
                }

                address.SetCodeCity(codeCity: line.CodeCity);
                customer.AddAddress(address);
            }

            if (!customer.Adresses.Where(a => a.Type == AddressType.Billing).Any())
            {
                customer.AddNotification($"Ops. Para adicionar um Cliente é necesssario um Endereço do tipo Cobrança");
                return(customer);
            }

            foreach (var line in model.Contacts)
            {
                var contact =
                    new Contact(firstName: line.FirstName,
                                lastName: line.LastName,
                                email: line.Email,
                                whatsApp: line.WhatsApp,
                                phone: line.Phone,
                                customerId: customer.Id);

                if (!contact.Valid)
                {
                    customer.AddNotification(contact.GetAllNotifications());
                    return(customer);
                }

                customer.AddContact(contact);
            }

            _customerRepository.Create(customer);
            _uow.Commit();

            return(customer);
        }
Exemple #25
0
        public async Task <IActionResult> InitializeDatabase(CancellationToken cancellationToken)
        {
            if (_dbContext.Countries.All().Any())
            {
                return(Ok("Already initialized"));
            }

            _dbContext.CommandTimeout = 60;
            _dbContext.BeginTransaction();
            //countries
            var countries = new List <Country>
            {
                new Country()
                {
                    Name = "USA"
                },
                new Country()
                {
                    Name = "China"
                },
                new Country()
                {
                    Name = "India"
                },
                new Country()
                {
                    Name = "Romania"
                },
            };
            await _dbContext.Countries.InsertManyAsync(countries, cancellationToken);

            //colors
            var colors = new List <Color>
            {
                new Color()
                {
                    Name = "White"
                },
                new Color()
                {
                    Name = "Black"
                },
                new Color()
                {
                    Name = "Red"
                },
                new Color()
                {
                    Name = "Green"
                },
                new Color()
                {
                    Name = "Blue"
                },
                new Color()
                {
                    Name = "Grey"
                },
            };
            await _dbContext.Colors.InsertManyAsync(colors, cancellationToken);

            //phone number types
            var phoneNumberTypes = new List <PhoneNumberType>
            {
                new PhoneNumberType()
                {
                    Name = "Fixed"
                },
                new PhoneNumberType()
                {
                    Name = "Mobile"
                },
                new PhoneNumberType()
                {
                    Name = "Business"
                },
            };
            await _dbContext.PhoneNumberTypes.InsertManyAsync(phoneNumberTypes, cancellationToken);

            await _dbContext.SaveChangesAsync(cancellationToken); // save changes but do not commit transaction (not required in this case)

            var random = new Random(15);

            //products
            var products = Enumerable.Range(1, 1000).Select(i =>

                                                            new Product()
            {
                Name   = "Product " + i,
                Colors = new List <Color> {
                    colors.ElementAt(random.Next(0, colors.Count - 1))
                },
                Price = random.Next(100, 10000) / 100m
            }
                                                            ).ToList();
            await _dbContext.Products.InsertManyAsync(products, cancellationToken);

            //customers
            var customer = new Customer()
            {
                BirthDate = DateTime.Now.AddYears(-40),
                FirstName = "John",
                LastName  = "Doe"
            };

            customer.AddAddress(new Address()
            {
                City        = "New York",
                Country     = countries.First(),
                StreetName  = "Cooper Square",
                StretNumber = 20
            });
            customer.AddPhoneNumber(new CustomerPhone()
            {
                PhoneNumber     = "123456789",
                PhoneNumberType = phoneNumberTypes.First()
            });
            var cart = new CustomerCart();

            customer.SetCart(cart);
            Enumerable.Range(1, random.Next(1, 20))
            .Select(x => products.ElementAt(random.Next(0, products.Count - 1)))
            .ToList()
            .ForEach(p => cart.Products.Add(p));
            cart.LastUpdated = DateTime.UtcNow;
            await _dbContext.Customers.InsertAsync(customer, cancellationToken);

            //customer 2 - empty cart
            var customer2 = new Customer()
            {
                BirthDate = DateTime.Now.AddYears(-36),
                FirstName = "CSharp",
                LastName  = "Bender"
            };

            customer2.AddAddress(new Address()
            {
                City        = "Bucharest",
                Country     = countries.Last(),
                StreetName  = "Universitatii Street",
                StretNumber = 13
            });
            customer2.AddPhoneNumber(new CustomerPhone()
            {
                PhoneNumber     = "123456789",
                PhoneNumberType = phoneNumberTypes.First()
            });
            customer2.SetCart(new CustomerCart());
            await _dbContext.Customers.InsertAsync(customer2, cancellationToken);

            //customer 3 - basic info
            var customer3 = new Customer()
            {
                BirthDate = DateTime.Now.AddYears(-16),
                FirstName = "Mike",
                LastName  = "Golden"
            };
            await _dbContext.Customers.InsertAsync(customer3, cancellationToken);

            await _dbContext.SaveChangesAsync(cancellationToken);

            await _dbContext.CommitTransactionAsync(cancellationToken);

            return(Ok("Initialization complete"));
        }