public async Task Update_Entity() { var context = new InMemoryDataContext(); var repository = new EntityFrameworkCoreRepository <Customer, InMemoryDataContext>(context); var newEntity = await repository.Insert(new Customer() { Name = _entityDefaultName }); var existing = await repository.Get(newEntity.ID); existing.Name = _entityNewName; await repository.Update(existing); var updated = await repository.Get(newEntity.ID); Assert.IsNotNull(updated); }
public async Task GetWithProperties_Entity() { var context = new InMemoryDataContext(); var repository = new EntityFrameworkCoreRepository <Customer, InMemoryDataContext>(context); var productRepository = new EntityFrameworkCoreRepository <Product, InMemoryDataContext>(context); var newProductEntity = await productRepository.Insert(new Product() { Name = _productName }); var newEntity = await repository.Insert(new Customer() { Name = _entityDefaultName }); newEntity.Products.Add(newProductEntity); var updatedEntity = await repository.Update(newEntity); var existing = await repository.Get(includeProperties : "Products"); Assert.IsNotNull(existing); }