예제 #1
0
        public async Task GetWhoisAsync_ValidParameters_ExpectedResult()
        {
            IUKFastRegistrarClient client = Substitute.For <IUKFastRegistrarClient>();

            client.GetAsync <Whois>("/registrar/v1/whois/ukfast.co.uk").Returns(new Whois()
            {
                Name = "ukfast.co.uk"
            });

            var ops   = new WhoisOperations <Whois>(client);
            var whois = await ops.GetWhoisAsync("ukfast.co.uk");

            Assert.AreEqual("ukfast.co.uk", whois.Name);
        }
예제 #2
0
        public async Task GetWhoisAsync_InvalidDomainName_ThrowsUKFastClientValidationException()
        {
            var ops = new WhoisOperations <Whois>(null);

            await Assert.ThrowsExceptionAsync <UKFastClientValidationException>(() => ops.GetWhoisAsync(""));
        }