public void TestTemplatedLinkWithVariable() { var link = new TemplatedLink <AccountDataResponse>( "https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7/data/{key}"); var uri = link.Resolve(new { key = "foobar" }); Assert.AreEqual("https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7/data/foobar", uri.ToString()); }
public void TestTemplatedLinkWithQueryParameters() { var link = new TemplatedLink <OperationResponse>( "https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7/operations{?cursor,limit,order}"); var uri = link.Resolve(new { limit = 10, order = OrderDirection.DESC, cursor = "now" }); var query = HttpUtility.ParseQueryString(uri.Query); Assert.AreEqual("10", query["limit"]); Assert.AreEqual("desc", query["order"]); Assert.AreEqual("now", query["cursor"]); }