public async Task GetWhoisRawAsync_ValidParameters_ExpectedResult() { IUKFastRegistrarClient client = Substitute.For <IUKFastRegistrarClient>(); client.GetAsync <string>("/registrar/v1/whois/ukfast.co.uk/raw").Returns("rawwhois"); var ops = new WhoisOperations <Whois>(client); var whois = await ops.GetWhoisRawAsync("ukfast.co.uk"); Assert.AreEqual("rawwhois", whois); }
public async Task GetDomainAsync_ValidParameters_ExpectedResult() { IUKFastRegistrarClient client = Substitute.For <IUKFastRegistrarClient>(); client.GetAsync <Domain>("/registrar/v1/domains/ukfast.co.uk").Returns(new Domain() { Name = "ukfast.co.uk" }); var ops = new DomainOperations <Domain>(client); var domain = await ops.GetDomainAsync("ukfast.co.uk"); Assert.AreEqual("ukfast.co.uk", domain.Name); }
public async Task GetDomainNameserversAsync_ExpectedResult() { IUKFastRegistrarClient client = Substitute.For <IUKFastRegistrarClient>(); client.GetAllAsync(Arg.Any <UKFastClient.GetPaginatedAsyncFunc <Nameserver> >(), null).Returns(Task.Run <IList <Nameserver> >(() => { return(new List <Nameserver>() { new Nameserver(), new Nameserver() }); })); var ops = new DomainNameserverOperations <Nameserver>(client); var nameservers = await ops.GetDomainNameserversAsync("ukfast.co.uk"); Assert.AreEqual(2, nameservers.Count); }
public async Task GetDomainsAsync_ExpectedResult() { IUKFastRegistrarClient client = Substitute.For <IUKFastRegistrarClient>(); client.GetAllAsync(Arg.Any <UKFastClient.GetPaginatedAsyncFunc <Domain> >(), null).Returns(Task.Run <IList <Domain> >(() => { return(new List <Domain>() { new Domain(), new Domain() }); })); var ops = new DomainOperations <Domain>(client); var domains = await ops.GetDomainsAsync(); Assert.AreEqual(2, domains.Count); }
public async Task GetDomainNameserversPaginatedAsync_ExpectedClientCall() { IUKFastRegistrarClient client = Substitute.For <IUKFastRegistrarClient>(); client.GetPaginatedAsync <Nameserver>("/registrar/v1/domains/ukfast.co.uk/nameservers").Returns(Task.Run(() => { return(new Paginated <Nameserver>(client, "/registrar/v1/domains/ukfast.co.uk/nameservers", null, new Response.ClientResponse <System.Collections.Generic.IList <Nameserver> >() { Body = new Response.ClientResponseBody <System.Collections.Generic.IList <Nameserver> >() { Data = new List <Nameserver>() { new Nameserver(), new Nameserver() } } })); })); var ops = new DomainNameserverOperations <Nameserver>(client); var paginated = await ops.GetDomainNameserversPaginatedAsync("ukfast.co.uk"); Assert.AreEqual(2, paginated.Items.Count); }
public WhoisOperations(IUKFastRegistrarClient client) : base(client) { }
public DomainOperations(IUKFastRegistrarClient client) : base(client) { }
public DomainNameserverOperations(IUKFastRegistrarClient client) : base(client) { }