public async Task RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new ProductsClient(connection); var filters = new ProductFilters { PageSize = 1, PageCount = 1, StartPage = 0 }; await client.GetAll(filters); Received.InOrder(async() => { await connection.GetAll <Product>( Arg.Is <Uri>(u => u.ToString() == "products"), Arg.Is <Dictionary <string, string> >(d => d.Count == 0), Arg.Is <ApiOptions>(o => o.PageSize == 1 && o.PageCount == 1 && o.StartPage == 0)); }); }
public async Task EnsuresNonNullArguments() { var client = new ProductsClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null)); }
// GET: Product public async Task <ActionResult> Index() { ProductsClient api = new ProductsClient(); return(View(api.GetAll())); }