public void GivenListOfProductsWhenSortedDescendingExpectCorrectOrder() { //Arrange IProductsSorter productsSorter = new ProductsSorter(); //Act List <Product> sortedProducts = productsSorter.SortProducts(_products, SortOptions.Descending); //Assert Assert.IsNotNull(sortedProducts); Assert.IsTrue(sortedProducts.Any()); Assert.IsTrue(sortedProducts.First().Name.CompareTo(sortedProducts[1].Name) > 0); Assert.IsTrue(sortedProducts[1].Name.CompareTo(sortedProducts.Last().Name) > 0); }
public void GivenListOfProductsWhenSortedHighExpectCorrectOrder() { //Arrange IProductsSorter productsSorter = new ProductsSorter(); //Act List <Product> sortedProducts = productsSorter.SortProducts(_products, SortOptions.High); //Assert Assert.IsNotNull(sortedProducts); Assert.IsTrue(sortedProducts.Any()); Assert.IsTrue(sortedProducts.First().Price > sortedProducts[1].Price); Assert.IsTrue(sortedProducts[1].Price > sortedProducts.Last().Price); }