public async Task testCreateDeliveryValidModel() { var controller = await ControllerSupplier.getShipperDeliveriesController(); //set Shipper to controller Company company = await createCompany(controller); controller.setCompany(company); var dbContext = controller.getDbContext(); Client client = ShipperDetailsHelper.getClient(); company.Clients.Add(client); await dbContext.SaveChangesAsync(); DeliveryDetails deliveryDetails = new DeliveryDetails(); deliveryDetails.ClientID = client.ID; // deliveryDetails.PickUpAddress = ShipperDetailsHelper.getDeliveryPickUpAddress(); var createResult = await controller.Create(deliveryDetails); var result = (ViewResult)controller.Index().Result; Assert.NotNull(result.Model); Assert.Equal(dbContext.Deliveries.Count(), 1); Delivery delivery = dbContext.Deliveries.ToList().First <Delivery>(); Assert.Equal(delivery.Client, client); Assert.Equal(delivery.DeliveryStatus.Status, Status.New); // Assert.Equal(delivery.PickUpAddress, deliveryDetails.PickUpAddress); }