Alvecta.Foundation.Deployment.Cdk.Testing 9.0.83

There is a newer version of this package available.
See the version list below for details.
dotnet add package Alvecta.Foundation.Deployment.Cdk.Testing --version 9.0.83
                    
NuGet\Install-Package Alvecta.Foundation.Deployment.Cdk.Testing -Version 9.0.83
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Alvecta.Foundation.Deployment.Cdk.Testing" Version="9.0.83" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Alvecta.Foundation.Deployment.Cdk.Testing" Version="9.0.83" />
                    
Directory.Packages.props
<PackageReference Include="Alvecta.Foundation.Deployment.Cdk.Testing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Alvecta.Foundation.Deployment.Cdk.Testing --version 9.0.83
                    
#r "nuget: Alvecta.Foundation.Deployment.Cdk.Testing, 9.0.83"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Alvecta.Foundation.Deployment.Cdk.Testing@9.0.83
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Alvecta.Foundation.Deployment.Cdk.Testing&version=9.0.83
                    
Install as a Cake Addin
#tool nuget:?package=Alvecta.Foundation.Deployment.Cdk.Testing&version=9.0.83
                    
Install as a Cake Tool

Alvecta.Foundation.Deployment.Cdk.Testing

Test support for the deployment tests of a solution whose CDK apps are built on Alvecta.Foundation.Deployment.Cdk. Reference it from a test project only; the Alvecta architecture tests fail a product project that references a *.Testing package.

What it provides

CdkJsonFile reads the repository's cdk.json - the one configuration the solution's CDK apps share - the way the Foundation hosts read it, so the tests run against the real environments rather than a fixture:

  • FindDirectory() — the nearest folder above the test output that holds cdk.json, the repository root in an Alvecta solution. Other repository files are read relative to it.
  • GetEnvironments(), GetEnvironment(environment), GetService(environment, service) — the context.Environments, context.Environments.<environment> and context.Environments.<environment>.Services.<service> sections, through the same CdkContextExtensions.GetSection the hosts navigate with, so a missing section fails naming it.
  • Environments and ConfiguredEnvironments — every environment of the file, and those whose AWS account is filled in, as xunit TheoryData<string>. A placeholder environment (an empty account) can be loaded and validated but not synthesized: CDK refuses an environment without an account.
  • CreateApp(environment) — a CDK app with the context the hosts read: the environment as env and the Environments section exactly as cdk.json holds it.

The file is read anew on every call.

Usage

[Collection(nameof(CdkAppCollection))]
public class CdkJsonDatabaseStackTests
{
    [Theory]
    [MemberData(nameof(CdkJsonFile.Environments), MemberType = typeof(CdkJsonFile))]
    public void Environment_ShouldLoadIntoTheEnvironmentConfig(string environment)
    {
        var config = SettingsLoader.Load<EnvironmentConfig>(CdkJsonFile.GetEnvironment(environment));

        Assert.NotEmpty(config.SsmParameterPrefix);
    }

    [Theory]
    [MemberData(nameof(CdkJsonFile.ConfiguredEnvironments), MemberType = typeof(CdkJsonFile))]
    public void DatabaseStack_ShouldSynthesize(string environment)
    {
        var app = CdkJsonFile.CreateApp(environment);
        // ... build the stack from app, then Template.FromStack(stack)
    }
}

JSII, the CDK's runtime bridge, is not safe to drive from several test threads at once, so the tests that create apps share a collection with parallelization disabled. xunit only reads collection definitions from the test assembly itself, so each test project declares its own:

[CollectionDefinition(nameof(CdkAppCollection), DisableParallelization = true)]
public class CdkAppCollection;

The walk up from the test output needs the output inside the repository (the default bin/ layout).

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.4.91 50 11/20/2026
9.3.90 92 11/13/2026
9.2.89 79 11/12/2026
9.1.88 88 11/11/2026
9.0.87 98 11/4/2026
9.0.86 91 11/4/2026
9.0.85 87 11/4/2026
9.0.84 93 11/4/2026
9.0.83 104 10/29/2026
9.0.82 104 10/29/2026