Skip to content

Commit

Permalink
Fix linter spacing error.
Browse files Browse the repository at this point in the history
  • Loading branch information
irenepsmith committed Sep 16, 2022
1 parent 8f7c0e7 commit 6e3eea9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace Cognito_MVP
{
/// <summary>
/// Class whose members perform Amazon Cognit methods for the scenario.
/// </summary>
public class CognitoMethods
{
/// <summary>
Expand All @@ -24,9 +27,11 @@ public static async Task<bool> AdminRespondToAuthChallenge(
{
Console.WriteLine("SOFTWARE_TOKEN_MFA challenge is generated");

var challengeResponses = new Dictionary<string, string>();
challengeResponses.Add("USERNAME", userName);
challengeResponses.Add("SOFTWARE_TOKEN_MFA_CODE", mfaCode);
var challengeResponses = new Dictionary<string, string>
{
{ "USERNAME", userName },
{ "SOFTWARE_TOKEN_MFA_CODE", mfaCode },
};

var respondToAuthChallengeRequest = new RespondToAuthChallengeRequest
{
Expand Down Expand Up @@ -123,12 +128,13 @@ public static async Task<string> GetSecretForAppMFA(
/// call.</returns>
public static async Task<InitiateAuthResponse> InitiateAuth(AmazonCognitoIdentityProviderClient identityProviderClient, string clientId, string userName, string password)
{
var authParameters = new Dictionary<string, string>();
authParameters.Add("USERNAME", userName);
authParameters.Add("PASSWORD", password);
var authParameters = new Dictionary<string, string>
{
{ "USERNAME", userName },
{ "PASSWORD", password },
};

var authRequest = new InitiateAuthRequest

{
ClientId = clientId,
AuthParameters = authParameters,
Expand Down Expand Up @@ -214,7 +220,7 @@ public static async Task ResendConfirmationCode(AmazonCognitoIdentityProviderCli
/// <returns></returns>
public static async Task GetAdminUser(AmazonCognitoIdentityProviderClient identityProviderClient, string userName, string poolId)
{
AdminGetUserRequest userRequest = new AdminGetUserRequest
var userRequest = new AdminGetUserRequest
{
Username = userName,
UserPoolId = poolId,
Expand Down Expand Up @@ -249,9 +255,10 @@ public static async Task SignUp(
Value = email,
};

var userAttrsList = new List<AttributeType>();

userAttrsList.Add(userAttrs);
var userAttrsList = new List<AttributeType>
{
userAttrs,
};

var signUpRequest = new SignUpRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ namespace Cognito_MVP.Tests
{
public class CognitoMethodsTests
{
private static AmazonCognitoIdentityProviderClient _Client = new AmazonCognitoIdentityProviderClient();
private static readonly AmazonCognitoIdentityProviderClient _Client = new AmazonCognitoIdentityProviderClient();
private static readonly string _UserName = "test-user";
private static readonly string _Password = "really-bad-password";
private static readonly string _UserEmail = "[email protected]";
private static readonly string _ClientId = "some-client-id";
private static string _Session = "";
private static string _MfaCode = "";

private static readonly string _PoolId = "";
private static string _Session = string.Empty;
private static string _MfaCode = string.Empty;

[Fact]
[Order(1)]
Expand Down Expand Up @@ -44,42 +48,46 @@ public static async Task VerifyTOTPTest()
[Order(6)]
public static async Task GetSecretForAppMFATest()
{

var session = await CognitoMethods.GetSecretForAppMFA(_Client, _Session);
Assert.Equal(_Session, session, true);
}

[Fact]
[Order(5)]
public void InitiateAuthTest()
public static async Task InitiateAuthTest()
{
Assert.True(false, "This test needs an implementation");
var response = await CognitoMethods.InitiateAuth(_Client, _ClientId, _UserName, _Password);
Assert.NotNull(response.Session);
}

[Fact]
[Order(4)]
public void ConfirmSignUpTest()
public static async Task ConfirmSignUpTest()
{
Assert.True(false, "This test needs an implementation");
var success = await CognitoMethods.ConfirmSignUp(_Client, _ClientId, _UserName, _Password);
Assert.True(success, "Couldn't confirm the user's signup status.");
}

[Fact]
[Order(3)]
public void ResendConfirmationCodeTest()
public static async Task ResendConfirmationCodeTest()
{
Assert.True(false, "This test needs an implementation");
await CognitoMethods.ResendConfirmationCode(_Client, _ClientId, _UserName);
// What do I test here?
}

[Fact]
[Order(2)]
public void GetAdminUserTest()
public static async Task GetAdminUserTest()
{
Assert.True(false, "This test needs an implementation");
await CognitoMethods.GetAdminUser(_Client, _UserName, _PoolId);
}

[Fact]
[Order(1)]
public void SignUpTest()
public static async Task SignUpTest()
{
Assert.True(false, "This test needs an implementation");
await CognitoMethods.SignUp(_Client, _ClientId, _UserName, _Password, _UserEmail);
}
}
}

0 comments on commit 6e3eea9

Please sign in to comment.