public IEnumerable <Product> GetProducts(string sortOption) { SortOption sortBy; if (string.IsNullOrWhiteSpace(sortOption)) { throw new ArgumentNullException(nameof(sortOption)); } if (!Enum.TryParse(sortOption, true, out sortBy)) { throw new ArgumentException(nameof(sortOption)); } var products = _productServiceAgent.GetProducts(); var store = new WooliesStore(); store.Load(products); return(store.SortBy(SimpleSortFactory.Create(sortBy))); }
public void GivenProductsIsNullThrowsArgumentNullException() { // act & assert Assert.Throws <ArgumentNullException>(() => _sut.Load(null)); }