private Token createTokenFromResponse(IHttpClientResponse response) { string accessValue = response.GetHeader("token"); int expirySeconds = int.Parse(response.GetHeader("tokenexpiry")); return(new Token { AccessValue = accessValue, ExpirySeconds = expirySeconds }); }
public async Task PostAuthenticate_WhenValidCredentials_ReturnsToken() { RestClient client = new RestClient(mockTokenProvider.Object); IHttpClientResponse response = await client.Post("http://online.cuprum.com/webapixamarin/Api/Authenticate/Authenticate", new { ClaveAcceso = "arodriguez", Contrasena = "admin123$" }); Assert.AreEqual("\"Authorized\"", response.GetContent()); Assert.IsNotNull(response.GetHeader("token")); }