Fhi.ClientCredentials.TestSupport 2.0.0-beta2

This is a prerelease version of Fhi.ClientCredentials.TestSupport.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Fhi.ClientCredentials.TestSupport --version 2.0.0-beta2                
NuGet\Install-Package Fhi.ClientCredentials.TestSupport -Version 2.0.0-beta2                
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="Fhi.ClientCredentials.TestSupport" Version="2.0.0-beta2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fhi.ClientCredentials.TestSupport --version 2.0.0-beta2                
#r "nuget: Fhi.ClientCredentials.TestSupport, 2.0.0-beta2"                
#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.
// Install Fhi.ClientCredentials.TestSupport as a Cake Addin
#addin nuget:?package=Fhi.ClientCredentials.TestSupport&version=2.0.0-beta2&prerelease

// Install Fhi.ClientCredentials.TestSupport as a Cake Tool
#tool nuget:?package=Fhi.ClientCredentials.TestSupport&version=2.0.0-beta2&prerelease                

Fhi.ClientCredentials.TestSupport

This package contains tests that checks your appsettings.*.json files for correct configuration of the ClientCredentials package. It checks that your settings for test and production are different, and that all your different test and dev projects uses the same settings.

The assumption here is that your production use a production based STS (Secure Token Service), wheres the other enviornments all use the same Test STS.

The package has a default STS of the NHN HelseId STS. This can be changed by overriden the STS properties in the main class, see below for details.

Usage

Include the package in your test project.

<ItemGroup>
    <PackageReference Include="Fhi.ClientCredentials.TestSupport" Version="1.0.0-beta.1" />
</ItemGroup>

Add the following test class to your project. In the base part of the constructor, list the differerent environments you have appsettings for, and for which there exists an appsettings.XXX.json file.

public class ClientConsistencyTests : Fhi.ClientCredentials.TestSupport.ClientCredentialKeyPairsConfigConsistencyTests
{
    public ClientConsistencyTests() : base(new List<string> { "QA", "AzureDev", "Test", "Development" },SetupBaseConfigTests.AppSettingsUsage.AppSettingsIsBaseOnly)
    {
    }
}

The different alternatives for the second base parameter, AppSettingsUsage is as follows:

 public enum AppSettingsUsage
    {
        AppSettingsIsProd,  // appsettings.prod exist and is merged with appsettings.json
        AppSettingsIsBaseOnly, // No seperate prod exist, appsettings.json is production, but when anything else is specified, merge is to happen
        AppSettingsIsTestWhenDev, // When developing, appsettings is development,  require seperate prod
        AppSettingsIsExplicit // Use only the specified appsettings.
    }
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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
2.0.0 495 11/26/2024
2.0.0-beta2 76 11/26/2024
1.0.0-beta.6 4,158 10/9/2023
1.0.0-beta.5 741 8/19/2023
1.0.0-beta.4 694 3/8/2023
1.0.0-beta.1 179 3/7/2023