public async Task testDeleteClient()
        {
            var controller = ControllerSupplier.getClientsController().Result;

            //set Shipper to controller
            var    context = controller.getDbContext();
            var    company = new Company();
            var    user    = context.ApplicationUsers.First <ApplicationUser>();
            Client client  = getClient();

            client.Address.City = Constants.DEFAULT_CITY;

            company.Clients.Add(client);
            context.Companies.Add(company);
            await context.SaveChangesAsync();

            Assert.Equal(context.Clients.Count <Client>(), 1);
            Assert.Equal(context.Addresses.Count <Address>(), 1);
            controller.setCompany(company);

            await controller.DeleteConfirmed(client.ID);

            Assert.Equal(company.Clients.Count, 0);
            Assert.Equal(context.Clients.Count <Client>(), 0);
            Assert.Equal(context.Addresses.Count <Address>(), 0);
        }
        public async Task testGetIndexPageAndCreateClient()
        {
            var controller = await ControllerSupplier.getClientsController();

            controller.setGoogleMaps(getMockGoogleMaps());
            //set Shipper to controller
            Company company = await createCompany(controller);

            controller.setCompany(company);


            var result = (ViewResult)controller.Index().Result;

            Assert.NotNull(result.Model);
            Assert.Equal(result.Model, company.Clients);

            Client newClient    = getClient();
            var    createResult = await controller.Create(newClient);

            result = (ViewResult)controller.Index().Result;
            Assert.NotNull(result.Model);
            Assert.Equal(company.Clients.Count, 1);

            Client client = company.Clients.First <Client>();

            Assert.Equal(result.Model, company.Clients);
            Assert.NotNull(client.Address);
            Assert.Equal(client.Address.City, Constants.DEFAULT_CITY);
            Assert.Equal(client.Address.LineOne, Constants.DEFAULT_ADDRESS_LINE_ONE);
            Assert.Equal(client.Address.PostCode, Constants.DEFAULT_POSTCODE);
        }
        public async Task testEditClient()
        {
            var controller = ControllerSupplier.getClientsController().Result;

            controller.setGoogleMaps(getMockGoogleMaps());
            //set Shipper to controller
            var    context = controller.getDbContext();
            var    company = new Company();
            Client client  = getClient();

            company.Clients.Add(client);
            context.Companies.Add(company);
            await context.SaveChangesAsync();

            controller.setCompany(company);


            var result = (ViewResult)controller.Index().Result;

            Assert.NotNull(result.Model);
            Assert.Equal(result.Model, company.Clients);

            var clientModel = new Client();

            //change email and leave the rest as it was
            clientModel.ID           = client.ID;
            clientModel.Email        = "*****@*****.**";
            clientModel.FirstName    = client.FirstName;
            clientModel.LastName     = client.LastName;
            clientModel.Address.City = Constants.DEFAULT_CITY;

            await controller.Edit(client.ID, clientModel);

            Assert.Equal(company.Clients.ToList <Client>().First().Email, "*****@*****.**");
            Assert.Equal(company.Clients.ToList <Client>().First().FirstName, client.FirstName);
            Assert.Equal(company.Clients.ToList <Client>().First().LastName, client.LastName);
            Assert.Equal(company.Clients.ToList <Client>().First().Address.City, client.Address.City);
        }