public void Test_Authentication_Error() { var request = new AuthRequest("", new char[0]); // test sample response message var message = new HttpResponseMessage(HttpStatusCode.BadRequest); Assert.IsFalse(request.WasSuccessful(message)); Assert.AreEqual(SeafErrorCode.InvalidCredentials, request.GetSeafError(message).SeafErrorCode); }
public void Test_Authentication_Success() { var request = new AuthRequest("", new char[0]); // test sample response message var message = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent("{ \"token\": \"" + FakeToken + "\" }") }; Assert.IsTrue(request.WasSuccessful(message)); var result = ExecuteSync(() => request.ParseResponseAsync(message)); Assert.IsNotNull(result); Assert.AreEqual(FakeToken, result.Token); }