public static async Task Main(string[] args) { DependencyFactory.Instance.RegisterDependencies(); IListClient client = DependencyFactory.Instance.Resolve <IListClient>(); var response = await client.GetSizeAsync(93798); Console.ReadLine(); }
public async Task Should_Retrieve_Size() { const int listId = 14; const int size = 309; string path = $"/api/lists/{listId}/size"; MockRestClient.Setup(m => m.GetContentAsync(It.Is <string>(a => a == path))).ReturnsAsync(new ApiResponse { UrlPath = path, HttpStatusCode = HttpStatusCode.OK, Content = size.ToString() }); ApiResponse <GetSizeResponse> response = await _listClient.GetSizeAsync(listId).ConfigureAwait(false); Assert.NotNull(response); Assert.NotNull(response.Model); Assert.Equal(size, response.Model.Size); Assert.Equal(HttpStatusCode.OK, response.HttpStatusCode); Assert.Equal(path, response.UrlPath); MockRestClient.Verify(m => m.GetContentAsync(It.Is <string>(a => a == path)), Times.Once); }