public async Task AdjustInventoryShouldAdjustInventoryCorrectlyWhenProductWarehouseDoesntExist() { var options = new DbContextOptionsBuilder <WHMSDbContext>().UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; using var context = new WHMSDbContext(options); var warehouse = new Warehouse { Address = new Address { }, Name = "Test", }; var product = new Product { ProductName = "Test Product", }; context.Warehouses.Add(warehouse); context.Products.Add(product); await context.SaveChangesAsync(); var service = new InventoryService(context); var adjustment = new ProductAdjustmentInputModel { ProductId = product.Id, Qty = 10, WarehouseId = warehouse.Id }; await service.AdjustInventoryAsync(adjustment); var productWarehouse = context.ProductWarehouses.FirstOrDefault(); var expected = 10; Assert.NotNull(productWarehouse); Assert.Equal(expected, productWarehouse.AggregateQuantity); }