public async Task GetDomainWAFRulesPaginatedAsync_ExpectedResult()
        {
            _client.GetPaginatedAsync <WAFRule>("/ddosx/v1/domains/test-domain.co.uk/waf/rules").Returns(
                Task.Run(() => new Paginated <WAFRule>(_client, "/ddosx/v1/domains/test-domain.co.uk/waf/rules", null,
                                                       new ClientResponse <IList <WAFRule> >()
            {
                Body = new ClientResponseBody <IList <WAFRule> >()
                {
                    Data = new List <WAFRule>()
                    {
                        new WAFRule(),
                        new WAFRule()
                    }
                }
            })));

            var ops       = new DomainWAFRuleOperations <WAFRule>(_client);
            var paginated = await ops.GetDomainWAFRulesPaginatedAsync("test-domain.co.uk");

            Assert.AreEqual(2, paginated.Items.Count);
        }
Example #2
0
        public async Task GetRecordsPaginatedAsync_ExpectedResult()
        {
            _client.GetPaginatedAsync <Record>("/ddosx/v1/records").Returns(
                Task.Run(() => new Paginated <Record>(_client, "/ddosx/v1/records", null,
                                                      new ClientResponse <IList <Record> >()
            {
                Body = new ClientResponseBody <IList <Record> >()
                {
                    Data = new List <Record>()
                    {
                        new Record(),
                        new Record()
                    }
                }
            })));

            var ops       = new RecordOperations <Record>(_client);
            var paginated = await ops.GetRecordsPaginatedAsync();

            Assert.AreEqual(2, paginated.Items.Count);
        }