Skip to content

Latest commit

 

History

History

testing-unit-cs

Deploy this example with Pulumi Deploy this example with Pulumi

Unit Testing Pulumi programs in C#

An example of writing mock-based unit tests with both infrastructure definition and tests written in C#. The example uses the NUnit test framework to define and run the tests, Moq for mocks, and FluentAssertions for assertions.

Prerequisites

Install .NET Core 3.1+

Running the tests

Run the tests:

$ dotnet test

Microsoft (R) Test Execution Command Line Tool Version 16.3.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 1.2167 Seconds

Further steps

Learn more about testing Pulumi programs: