public void GetDistributors_DistributorHasNoActivePrices_ReturnsNoDistributors() { var links = new[] { DbTestCaseFactory.WithActiveProductLink, DbTestCaseFactory.WithActiveProductLink, DbTestCaseFactory.WithDeletedProductLink }; var priceRecord = DbTestCaseFactory.UsedNotDeletedPriceRecord; priceRecord.Links = links; var price = DbTestCaseFactory.InactivePrice; price.PriceRecords = new[] { priceRecord, DbTestCaseFactory.UsedNotDeletedPriceRecord }; var distributor = DbTestCaseFactory.ActiveDistributor; distributor.Prices = new[] { price, DbTestCaseFactory.InactivePrice, DbTestCaseFactory.InactivePrice, DbTestCaseFactory.InactivePrice, }; var options = GetOptions(); using (var context = new TestDbContext(options)) { context.Distributors.Add(distributor); context.SaveChanges(); } using (var context = new TestDbContext(options)) { var actualDistributors = context.GetDistributors().ToArray(); Assert.That(actualDistributors.Length, Is.EqualTo(0)); } }