public async Task GetTemplateRecordsAsync_ExpectedResult()
        {
            IANSSafeDNSClient client = Substitute.For <IANSSafeDNSClient>();
            var ops = new TemplateRecordOperations <Record>(client);

            client.GetAllAsync(Arg.Any <ANSClient.GetPaginatedAsyncFunc <Record> >(), null).Returns(Task.Run <IList <Record> >(() =>
            {
                return(new List <Record>()
                {
                    new Record(),
                    new Record()
                });
            }));

            var records = await ops.GetRecordsAsync(123);

            Assert.AreEqual(2, records.Count);
        }
Esempio n. 2
0
        public async Task GetZoneNotesAsync_ExpectedResult()
        {
            IANSSafeDNSClient client = Substitute.For <IANSSafeDNSClient>();
            var ops = new ZoneNoteOperations <Note>(client);

            client.GetAllAsync(Arg.Any <ANSClient.GetPaginatedAsyncFunc <Note> >(), null).Returns(Task.Run <IList <Note> >(() =>
            {
                return(new List <Note>()
                {
                    new Note(),
                    new Note()
                });
            }));

            var notes = await ops.GetNotesAsync("example.com");

            Assert.AreEqual(2, notes.Count);
        }