public async Task <IActionResult> Get(string firstUser, string secondUser) { if (firstUser == null) { return(StatusCode((int)HttpStatusCode.BadRequest, "You have not include firstUser parameter in the URI.")); } if (secondUser == null) { return(StatusCode((int)HttpStatusCode.BadRequest, "You have not include secondUser parameter in the URI.")); } var customerKey = Configuration["TwitterCustomerKey"]; var customerSecret = Configuration["TwitterCustomerSecret"]; _token = await _tokenProvider.GetAsync(customerKey, customerSecret); CompareUsersResult result = null; try { result = await _compare.CompareUsers(_token, firstUser, secondUser); } catch (WebException e) { if (e.Message.Contains("Content not found")) { return(StatusCode((int)HttpStatusCode.NotFound, e.Message + " on Twitter.")); } if (e.Status == WebExceptionStatus.ReceiveFailure) { return(StatusCode((int)HttpStatusCode.RequestTimeout, e.Message)); } } return(Ok(Json(result))); }
public async Task compare_two_users_return_not_empty_object() { var result = await _compare.CompareUsers(_token, _firstUser, _secondUser); result.ShouldNotBeNull(); }