public async Task Fetch_List_Sequence() { var token = "abc"; var expected1 = new[] { 1, 2, 3 }; var list1 = new List(token, expected1); var expected2 = new[] { 4, 5 }; var list2 = new List(null, expected2); var expected = expected1.Concat(expected2).ToArray(); var api = new Mock <ISampleApi>(); api .Setup(api => api.GetListAsync()) .Returns(Task.FromResult(list1)); api .Setup(api => api.GetListAsync(token)) .Returns(Task.FromResult(list2)); var client = new SampleClient(api.Object); var ids = await client.Ids().ToArrayAsync(); CollectionAssert.AreEqual(expected, ids); }
public async Task Fetch_List() { var expected = new[] { 1, 2 }; var list = new List(null, expected); var api = new Mock <ISampleApi>(); api .Setup(api => api.GetListAsync()) .Returns(Task.FromResult(list)); var client = new SampleClient(api.Object); var ids = await client.Ids().ToArrayAsync(); CollectionAssert.AreEqual(expected, ids); }