AWSSDK_DotNet.IntegrationTests.Tests.IAM.IAMUtil.CreateTestUser C# (CSharp) Method

CreateTestUser() static private method

static private CreateTestUser ( AmazonIdentityManagementServiceClient client, string testPrefix ) : string
client Amazon.IdentityManagement.AmazonIdentityManagementServiceClient
testPrefix string
return string
        internal static string CreateTestUser(AmazonIdentityManagementServiceClient client, string testPrefix)
        {
            var prefix = MakePath(testPrefix);
            string username = "sdk-testuser-" + DateTime.Now.Ticks;
            client.CreateUserAsync(new CreateUserRequest() { UserName = username, Path = prefix }).Wait();
            return username;
        }

Usage Example

Beispiel #1
0
        //[ExpectedException(typeof(NoSuchEntityException))]
        public void TestDeleteNonExistentAccessKeyException()
        {
            string username = IAMUtil.CreateTestUser(Client);

            try
            {
                CreateAccessKeyResponse response =
                    Client.CreateAccessKeyAsync(new CreateAccessKeyRequest()
                {
                    UserName = username
                }).Result;

                string keyId = response.AccessKey.AccessKeyId;

                Client.DeleteAccessKeyAsync(new DeleteAccessKeyRequest()
                {
                    UserName = username, AccessKeyId = keyId
                }).Wait();
                Client.DeleteAccessKeyAsync(new DeleteAccessKeyRequest()
                {
                    UserName = username, AccessKeyId = keyId
                }).Wait();
            }
            catch (AggregateException ae)
            {
                AssertExtensions.VerifyException <NoSuchEntityException>(ae);
            }
            finally
            {
                IAMUtil.DeleteTestUsers(Client, username);
            }
        }
All Usage Examples Of AWSSDK_DotNet.IntegrationTests.Tests.IAM.IAMUtil::CreateTestUser