public async Task GetZoneRecordsPaginatedAsync_ExpectedClientCall() { IANSSafeDNSClient client = Substitute.For <IANSSafeDNSClient>(); client.GetPaginatedAsync <Record>("/safedns/v1/zones/example.com/records").Returns(Task.Run(() => { return(new Paginated <Record>(client, "/safedns/v1/zones/example.com/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 ZoneRecordOperations <Record>(client); var paginated = await ops.GetRecordsPaginatedAsync("example.com"); Assert.AreEqual(2, paginated.Items.Count); }
public async Task GetZoneRecordsPaginatedAsync_InvalidZoneID_ThrowsANSClientValidationException() { var ops = new ZoneRecordOperations <Record>(null); await Assert.ThrowsExceptionAsync <ANSClientValidationException>(() => ops.GetRecordsPaginatedAsync("")); }