public async Task GetTemplateRecordsPaginatedAsync_ExpectedClientCall() { IANSSafeDNSClient client = Substitute.For <IANSSafeDNSClient>(); client.GetPaginatedAsync <Record>("/safedns/v1/templates/123/records").Returns(Task.Run(() => { return(new Paginated <Record>(client, "/safedns/v1/templates/123/records", null, new Response.ClientResponse <System.Collections.Generic.IList <Record> >() { Body = new Response.ClientResponseBody <System.Collections.Generic.IList <Record> >() { Data = new List <Record>() { new Record(), new Record() } } })); })); var ops = new TemplateRecordOperations <Record>(client); var paginated = await ops.GetRecordsPaginatedAsync(123); Assert.AreEqual(2, paginated.Items.Count); }
public async Task GetZoneNotesPaginatedAsync_ExpectedClientCall() { IANSSafeDNSClient client = Substitute.For <IANSSafeDNSClient>(); client.GetPaginatedAsync <Note>("/safedns/v1/zones/example.com/notes").Returns(Task.Run(() => { return(new Paginated <Note>(client, "/safedns/v1/zones/example.com/notes", null, new Response.ClientResponse <System.Collections.Generic.IList <Note> >() { Body = new Response.ClientResponseBody <System.Collections.Generic.IList <Note> >() { Data = new List <Note>() { new Note(), new Note() } } })); })); var ops = new ZoneNoteOperations <Note>(client); var paginated = await ops.GetNotesPaginatedAsync("example.com"); Assert.AreEqual(2, paginated.Items.Count); }