Skip to content

Commit

Permalink
fix AWSOptions for test
Browse files Browse the repository at this point in the history
  • Loading branch information
Blind-Striker committed Sep 22, 2023
1 parent 1ee44d1 commit e1233e1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ public void CreateServiceClient_Should_Create_Client_When_UseLocalStack_False()
configurationBuilder.AddInMemoryCollection(new KeyValuePair<string, string?>[] { new("LocalStack:UseLocalStack", "false") });
IConfigurationRoot configurationRoot = configurationBuilder.Build();

Environment.SetEnvironmentVariable("AWS_ACCESS_KEY_ID", "AKIAIOSFODNN7EXAMPLE");
Environment.SetEnvironmentVariable("AWS_SECRET_ACCESS_KEY", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");
Environment.SetEnvironmentVariable("AWS_DEFAULT_REGION", "us-west-2");
// Explicit AWS SDK configuration
var awsOptions = new AWSOptions
{
Credentials = new BasicAWSCredentials("AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"), Region = RegionEndpoint.USWest2
};

ServiceCollection serviceCollection = new();
serviceCollection.AddLocalStack(configurationRoot);
serviceCollection.AddDefaultAWSOptions(awsOptions);
serviceCollection.AddAWSServiceLocalStack<IAmazonS3>();
ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();

Expand Down

0 comments on commit e1233e1

Please sign in to comment.