Issue #, if available:
https://github.com/aws/aws-aspnet-cognito-identity-provider/issues/151Description of changes:*
Mock testing CognitoUser using Moq fails because it needs virtual methods to create a proxy with [1].
Currently the workaround is to write a subclass to wrap around the CognitoUser class as follows
public class CustomCognitoUser : CognitoUser
{
public CustomCognitoUser(string userID, string clientID, CognitoUserPool pool, IAmazonCognitoIdentityProvider provider, string? clientSecret = null, string? status = null, string? username = null, Dictionary<string, string>? attributes = null) : base(userID, clientID, pool, provider, clientSecret, status, username, attributes)
{
}
public virtual new Task<AuthFlowResponse> StartWithAdminNoSrpAuthAsync(InitiateAdminNoSrpAuthRequest adminAuthRequest)
{
return base.StartWithAdminNoSrpAuthAsync(adminAuthRequest);
}
}
This PR makes the methods of CognitoUser virtual so we can write mock test cases for CognitoUser class.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: https://github.com/aws/aws-aspnet-cognito-identity-provider/issues/151 Description of changes:* Mock testing
CognitoUser
using Moq fails because it needs virtual methods to create a proxy with [1]. Currently the workaround is to write a subclass to wrap around the CognitoUser class as followsThis PR makes the methods of CognitoUser virtual so we can write mock test cases for
CognitoUser
class.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.