https://pulumi.com logo
Title
p

prehistoric-coat-10166

03/22/2021, 11:37 AM
To mock `Pulumi.Config`it must be done via
PULUMI_CONFIG
environment variable for example I have the following utility method I use for my unit tests
public static void WithConfig(Dictionary<string, object> config)
    {
        var values = System.Text.Json.JsonSerializer.Serialize(config, new System.Text.Json.JsonSerializerOptions()
        {
        });

        Environment.SetEnvironmentVariable("PULUMI_CONFIG", values);
    }
Which I can then use in my test like so
WithConfig(new Dictionary<string, object>()
{
    { "key:value", "test-value" },
});
👍 1