// Fail in login request and verify the exception. // Response-or-exception argument should either a string // with the provided response or an exception to be thrown. // The iterations request is not supposed to fail and it's // given a valid server response with the proper iteration count. private static void LoginAndVerifyExceptionInLoginRequest(ResponseOrException loginResponseOrException, LoginException.FailureReason reason, string message, Action <Exception> verifyInnerException) { LoginAndVerifyException(IterationsResponse, loginResponseOrException, reason, message, verifyInnerException); }
// The most generic version. It expects on the requests to fail with an exception. // The exception is verified against the expectations. private static void LoginAndVerifyException(ResponseOrException iterationsResponseOrException, ResponseOrException loginResponseOrException, LoginException.FailureReason reason, string message, Action <Exception> verifyInnerException) { var exception = LoginAndFailWithException(NoMultifactorPassword, iterationsResponseOrException, loginResponseOrException); Assert.AreEqual(reason, exception.Reason); Assert.AreEqual(message, exception.Message); verifyInnerException(exception.InnerException); }
// See the overload with an action. private static void LoginAndVerifyExceptionInLoginRequest(ResponseOrException loginResponseOrException, LoginException.FailureReason reason, string message) { LoginAndVerifyExceptionInLoginRequest(loginResponseOrException, reason, message, Assert.IsNull); }
// See the overload with an action. private static void LoginAndVerifyExceptionInLoginRequest <TInnerExceptionType>(ResponseOrException loginResponseOrException, LoginException.FailureReason reason, string message) { LoginAndVerifyExceptionInLoginRequest(loginResponseOrException, reason, message, Assert.IsInstanceOf <TInnerExceptionType>); }