public void TestToRequestParameters() { var lParams = new GetProductParams(); var paramList = new List <RequestParam>(); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); lParams.Amount = 1000L; paramList.Add(new RequestParam("amount", "1000")); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); lParams.CountryCode = "NL"; paramList.Add(new RequestParam("countryCode", "NL")); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); lParams.CurrencyCode = "EUR"; paramList.Add(new RequestParam("currencyCode", "EUR")); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); lParams.IsRecurring = true; paramList.Add(new RequestParam("isRecurring", "true")); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); lParams.Locale = "nl_NL"; paramList.Add(new RequestParam("locale", "nl_NL")); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); lParams.AddHide("fields"); paramList.Add(new RequestParam("hide", "fields")); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); lParams.AddHide("accountsOnFile"); paramList.Add(new RequestParam("hide", "accountsOnFile")); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); lParams.Amount = null; paramList.RemoveAt(0); Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList)); }
public async void Example() { #pragma warning disable 0168 using (Client client = GetClient()) { GetProductParams query = new GetProductParams(); query.Amount = 1000L; query.IsRecurring = true; query.CountryCode = "US"; query.Locale = "en_US"; query.CurrencyCode = "USD"; query.AddHide("fields"); PaymentProductResponse response = await client.Merchant("merchantId").Products().Get(1, query); } #pragma warning restore 0168 }