forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4240a61
commit 7208315
Showing
7 changed files
with
140 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
dotnetv3/Cognito/scenarios/Cognito_Basics/Cognito_MVPTests/CognitoMethodsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
namespace Cognito_MVP.Tests | ||
{ | ||
public class CognitoMethodsTests | ||
{ | ||
private static AmazonCognitoIdentityProviderClient _Client = new AmazonCognitoIdentityProviderClient(); | ||
private static readonly _UserName = "test-user"; | ||
|
||
[Fact] | ||
[Order(1)] | ||
public static async Task AdminRespondToAuthChallengeTest() | ||
{ | ||
var userName = "test-user"; | ||
var clientId = "some-client-id"; | ||
var mfaCode = "abcdefg-etc"; | ||
var session = "not a session"; | ||
var success = await CognitoMethods.AdminRespondToAuthChallenge(_Client, userName, clientId, mfaCode, session); | ||
Assert.True(success, "Challenge failed to authenticate user."); | ||
} | ||
|
||
[Fact] | ||
[Order(1)] | ||
public static async Task AdminRespondToAuthChallengeTest_WithNonsense_ShouldFail() | ||
{ | ||
var userName = "test-user"; | ||
var clientId = "some-client-id"; | ||
var mfaCode = "abcdefg-etc"; | ||
var session = "not a session"; | ||
var success = await CognitoMethods.AdminRespondToAuthChallenge(_Client, userName, clientId, mfaCode, session); | ||
Assert.False(success, "Challenge should fail with bad information."); | ||
} | ||
|
||
[Fact] | ||
[Order(7)] | ||
public static async Task VerifyTOTPTest() | ||
{ | ||
var session = ""; | ||
var code = ""; | ||
var success = await CognitoMethods.VerifyTOTP(_Client, session, code); | ||
Assert.True(success, "Could not verify the one-time password."); | ||
} | ||
|
||
[Fact] | ||
[Order(6)] | ||
public static async Task GetSecretForAppMFATest() | ||
{ | ||
|
||
} | ||
|
||
[Fact] | ||
[Order(5)] | ||
public void InitiateAuthTest() | ||
{ | ||
Assert.True(false, "This test needs an implementation"); | ||
} | ||
|
||
[Fact] | ||
[Order(4)] | ||
public void ConfirmSignUpTest() | ||
{ | ||
Assert.True(false, "This test needs an implementation"); | ||
} | ||
|
||
[Fact] | ||
[Order(3)] | ||
public void ResendConfirmationCodeTest() | ||
{ | ||
Assert.True(false, "This test needs an implementation"); | ||
} | ||
|
||
[Fact] | ||
[Order(2)] | ||
public void GetAdminUserTest() | ||
{ | ||
Assert.True(false, "This test needs an implementation"); | ||
} | ||
|
||
[Fact] | ||
[Order(1)] | ||
public void SignUpTest() | ||
{ | ||
Assert.True(false, "This test needs an implementation"); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
dotnetv3/Cognito/scenarios/Cognito_Basics/Cognito_MVPTests/Cognito_MVPTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AWSSDK.CognitoIdentity" Version="3.7.0.204" /> | ||
<PackageReference Include="AWSSDK.Core" Version="3.7.13.2" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" /> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="Xunit.Extensions.Ordering" Version="1.4.5" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Cognito_MVP\Cognito_MVP.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
13 changes: 13 additions & 0 deletions
13
dotnetv3/Cognito/scenarios/Cognito_Basics/Cognito_MVPTests/GlobalUsings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
global using Amazon; | ||
global using Amazon.CognitoIdentityProvider; | ||
global using Amazon.CognitoIdentityProvider.Model; | ||
global using Cognito_MVP; | ||
global using Xunit; | ||
global using Xunit.Extensions.Ordering; | ||
|
||
// Optional. | ||
[assembly: CollectionBehavior(DisableTestParallelization = true)] | ||
// Optional. | ||
[assembly: TestCaseOrderer("Xunit.Extensions.Ordering.TestCaseOrderer", "Xunit.Extensions.Ordering")] | ||
// Optional. | ||
[assembly: TestCollectionOrderer("Xunit.Extensions.Ordering.CollectionOrderer", "Xunit.Extensions.Ordering")] |