public void Linq7_Customers_Returns5() { var expectedResult = new[] { new Linq7CategoryGroup { Category = "Beverages", UnitsInStockGroup = new[] { new Linq7UnitsInStockGroup { UnitsInStock = 39, Prices = new [] { 19.0000M } }, new Linq7UnitsInStockGroup { UnitsInStock = 17, Prices = new [] { 18.0000M } } } }, new Linq7CategoryGroup { Category = "Condiments", UnitsInStockGroup = new[] { new Linq7UnitsInStockGroup { UnitsInStock = 15, Prices = new [] { 10.0000M, 40.0000M } }, new Linq7UnitsInStockGroup { UnitsInStock = 13, Prices = new [] { 30.0000M } } } } }; var result = LinqTask.Linq7(DataSource.Products); foreach (var categoryGroup in result) { var expectedCategoryGroup = expectedResult.Single(_ => _.Category == categoryGroup.Category); foreach (var unitInStockGroup in categoryGroup.UnitsInStockGroup) { var expectedUnitInStockGroup = expectedCategoryGroup .UnitsInStockGroup.Single(_ => _.UnitsInStock == unitInStockGroup.UnitsInStock); CollectionAssert.AreEqual(expectedUnitInStockGroup.Prices, unitInStockGroup.Prices); } } }
public void Linq7_NullProducts_ThrowsArgumentNullException() { Assert.That(() => LinqTask.Linq7(null).ToList(), Throws.ArgumentNullException); }