public void GetProductPrices_Returns_Correct_Prices() { // Arrange Product product1 = GetProductWithName("Name1"); Product product2 = GetProductWithName("Name2"); product2.Id = 2; ProductContext ctx = new ProductContext(new DbContextOptions <ProductContext>()); ctx.Products = GetProductDbSet(product1, product2); ProductPrice price1a = GetPrice(product1); ProductPrice price1b = GetPrice(product1); ProductPrice price2a = GetPrice(product2); ProductPrice price2b = GetPrice(product2); ctx.Prices = GetPricesDbSet(price1a, price1b, price2a, price2b); SqlProductRepository target = new SqlProductRepository(ctx); // Act var result = target.GetProductPrices(2); // Assert Assert.Contains(price2a, result); Assert.Contains(price2b, result); }