Siemens.AspNet.MsTest.Sdk
                               
                            
                                0.1.0-alpha.185
                            
                        
                            
                                
                                
                                    Prefix Reserved
                                
                            
                    See the version list below for details.
dotnet add package Siemens.AspNet.MsTest.Sdk --version 0.1.0-alpha.185
NuGet\Install-Package Siemens.AspNet.MsTest.Sdk -Version 0.1.0-alpha.185
<PackageReference Include="Siemens.AspNet.MsTest.Sdk" Version="0.1.0-alpha.185" />
<PackageVersion Include="Siemens.AspNet.MsTest.Sdk" Version="0.1.0-alpha.185" />
<PackageReference Include="Siemens.AspNet.MsTest.Sdk" />
paket add Siemens.AspNet.MsTest.Sdk --version 0.1.0-alpha.185
#r "nuget: Siemens.AspNet.MsTest.Sdk, 0.1.0-alpha.185"
#:package Siemens.AspNet.MsTest.Sdk@0.1.0-alpha.185
#addin nuget:?package=Siemens.AspNet.MsTest.Sdk&version=0.1.0-alpha.185&prerelease
#tool nuget:?package=Siemens.AspNet.MsTest.Sdk&version=0.1.0-alpha.185&prerelease
Siemens.AspNet.MsTest.Sdk
This NuGet package provides utilities for API testing with a focus on AWS DynamoDB and Docker. It helps set up DynamoDB services within a Docker container for testing purposes and includes additional features to manage environment variables and API interactions.
Features
- DynamoDB Helper: Set up and interact with AWS DynamoDB in a Docker container.
 - Docker Helper: Spin up Docker containers for AWS DynamoDB.
 - API Test Utilities: Provides utilities for setting up API testing environments, including the configuration of environment variables.
 - Support for Multiple Environments: Easily configure testing environments, such as Development, Staging, or Production, with environment variables.
 
Installation
You can install this package using the following NuGet command:
dotnet add package Siemens.AspNet.MsTest.Sdk
Setup Example
API Test Base Setup
The following example demonstrates how to initialize the testing environment, configure DynamoDB, and set up environment variables.
/// <summary>
///     The base class for API testing, providing utilities for setting up and interacting with the API.
/// </summary>
private static ApiTestBase<Program> _apiTestBase = null!;
protected static HttpClient Client { get; private set; } = null!;
private static readonly IDynamoDbService DynamoDbService = DynamoDbServiceFactory.Create();
[AssemblyInitialize]
public static async Task AssemblyInitializeAsync(TestContext _)
{
    // 0. Ensure that previous tests were not interrupted
    await AssemblyCleanupAsync().ConfigureAwait(false);
    // 1. Setup DynamoDB service
    await DynamoDbService.SetupAsync<Program>().ConfigureAwait(false);
    // 2. Load environment variables
    var environmentVariables = EmbeddedFile.GetFileContentFrom("Properties.EnvironmentVariables.json")
                                           .FromJsonStringAs<Dictionary<string, string>>()
                                           .Select(keyValue => (keyValue.Key, keyValue.Value)).ToArray();
    // 3. Setup API test base environment
    _apiTestBase = new ApiTestBase<Program>("Development", // The environment name
                                            (_, _) =>
                                            {
                                            }, // Register services action
                                            environmentVariables); // Configure environment variables  
    // Additional setup logic can be added here
}
DynamoDB Docker Setup
The package includes utilities to set up a Docker container with AWS DynamoDB to simulate a real database environment for testing.
// Factory creation
// Sample code for running DynamoDB in a Docker container
var DynamoDbService = DynamoDbServiceFactory.Create();
// Via service collection
serviceCollection.AddDynamoDbService();
Contributing
Feel free to open issues or submit pull requests. If you are interested in contributing, please ensure to follow the coding standards and best practices used in this repository.
| Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. | 
- 
                                                    
net9.0
- DotNetTool.Service (>= 0.3.0)
 - MSTest.TestFramework (>= 3.9.3)
 - Polly (>= 8.6.1)
 - Siemens.AspNet.MinimalApi.Sdk (>= 0.1.0-alpha.185)
 
 
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.