Mocking API Calls for Unit Tests with Mockoon and Nunit

Viewed 22

I am new to Nunit and have some tests that perform API calls for a .NET 6 Web API app. I want to convert these into true unit tests by removing those external dependencies. I was looking into mocking and found Mockoon.

How I would go about mocking API calls? Can I do it with Mockoon?

I wasn't sure how I could change the API calls programmatically to point to a mock API for testing only.

The ultimate goal is to automate the testing in GitHub Actions but since the tests have external dependencies, these need to be mocked first. Mockoon provides a CLI to deploy in GitHub Actions.

My project was created in VS Code so I'm not sure if Visual Studio utilities would help with configurations.

If you need any more information, please let me know. Thanks!

0 Answers
Related