.NET Web API Application Development Using ChatGPT-Part 2 Unit Testing

Photo by Alex on Unsplash

Introduction

Previously, we have covered the basic setup and implementation of the project, using the chat gpt capabilities. In this article we will be focusing on unit test creation as long as with comprehensive troubleshooting of issues for the following functionality: mapping functionality, repository functionality using in-memory db and the api endpoints functionality using the webAppFactory approach.

Prerequisites:

  • Create a new test project CustomerApi.Tests in the root folder of the repository that will be used to write the required unit tests.
  • Add project reference to CustomerApi
  • Install the Automapper nuget package

Interaction Summary with Code Snippets

Unit test Creation

User:

ok now i want to proceed with next part of the development which is the “Introduce tests for mapping, repository using in-memory db, endpoints using webAppFactory and repository” Thus, i will ask you to create unit tests for specific classes. I have created a Nunit3 test project named. as “CustomerApi.Tests”and will place all the unit tests there.

Leave a Reply