public async Task CalledWithLanguageOption_DoesNotBreak(string language) { // Act var result = await _client.GetLists(_settings.SessionId, language : language); _output.WriteLine($"Server returned {result.HttpStatusCode}, message: {result?.Json ?? "some error..."}"); GetListsModel lists = JsonConvert.DeserializeObject <GetListsModel>(result?.Json); // Assert Assert.True(result.HttpStatusCode == System.Net.HttpStatusCode.OK); Assert.True(result?.Json != null); Assert.True(lists != null); }
// happy path public async Task CalledWithUsersOwnAccountId_ReturnsListForCurrentAccount() { // Act var result = await _client.GetLists(_settings.SessionId, 8341984); _output.WriteLine($"Server returned {result.HttpStatusCode}, message: {result?.Json ?? "some error..."}"); GetListsModel lists = JsonConvert.DeserializeObject <GetListsModel>(result?.Json); // Assert Assert.True(result.HttpStatusCode == System.Net.HttpStatusCode.OK); Assert.True(result?.Json != null); Assert.True(lists != null); }
public async Task <TryGetListsResponse> TryGetLists(int?accountId = null, string language = null, int?page = null, int retryCount = 0, int delayMilliseconds = 1000, bool fromCache = true) { var response = await _cachedSearchClient.GetLists(_settings.SessionId, accountId, language, page, retryCount, delayMilliseconds, fromCache); GetListsModel lists = null; if (response.HttpStatusCode.IsSuccessCode()) { lists = JsonConvert.DeserializeObject <GetListsModel>(response.Json); } return(new TryGetListsResponse(response.HttpStatusCode, lists)); }
public TryGetListsResponse(HttpStatusCode statusCode, GetListsModel listsModel) { HttpStatusCode = statusCode; ListsModel = listsModel; }