Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 2.19 KB

File metadata and controls

58 lines (37 loc) · 2.19 KB

Contribution Guides

  1. Get Set up
  2. Test Your Changes
  3. Write Unit Tests
  4. Submit a PR
  5. Publish Your Changes

3. Write Unit Tests

After making changes, you should make sure they are covered by Unit Tests. If the existing UTs are not covering your changes, please, update them and/or create new ones.

  1. Make sure you are not breaking the existing UTs by running them locally.

    1. Go to the project root directory

      # navigate to the repository
      cd communication-services-authentication-hero-csharp/
    2. run the existing unit tests

      # Run UTs
      dotnet run test
  2. If your change is not covered by the existing UTs, you will need to create new ones.

    1. Tests folder structure

      All UTs should be defined under the tests folder which is structured as follow:

      • controllers
        • controllerNameUnitTests.cs - implements a test suite for this controller method.
      • services
        • serviceNameUnitTests.cs - implements a test suite for this service method.
    2. If your change is in an existing method, simply add UTs in the corresponding test suite.

      For example, if your change is in UserControllerUnitTests.CreateACSUser_Returns_Status201, add UTs to tests/UntiTests/Controllers/UserControllerUnitTests.cs.

    3. If your change is in a new service or controller, create a new test file (with extension ....UnitTest.cs) and implement the test suite corresponding to this method.

More Information

- To lean more about Unit Testing Best Practices, visit:

- To lean more about How to do unit testing using xUnit, visit: