public async Task EnsuresSearchTermIsMoreThan3Characters()
            {
                var client = new ProductsClient(Substitute.For <IApiConnection>());

                var exception = await Assert.ThrowsAsync <Exception>(() => client.GetByName("pr", null));

                Assert.Equal("searchTerm must be a minimum of 3 characters in length", exception.Message);
            }
            public async Task RequestsCorrectUrlWithOneParameter()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new ProductsClient(connection);

                await client.GetByName("product");

                Received.InOrder(async() =>
                {
                    await connection.GetAll <SimpleProduct>(Arg.Is <Uri>(u => u.ToString() == "products/find"),
                                                            Arg.Is <Dictionary <string, string> >(d => d.Count == 1 &&
                                                                                                  d["term"] == "product"));
                });
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new ProductsClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetByName(null, null));
            }