- Open your Web API solution in Visual Studio
- In the Solution Explorer, right-click the Solution to open a menu.
- Use the menu select Add / New Project to open the Add New Project dialog.
- On the left panel, click the Test node under Visual C#.
- In the center panel, click xUnit Test Project (.NET Core).
- Enter a name for your project in the Name textbox at the bottom of the form. (something like "<YOUR_WEB_API_PROJECT_NAME>.Tests", ex.
StudentExercisesAPI.Tests
)
Now we need to setup the new Test Project with a reference to your Web API project AND with the correct Nuget packages needed to perform Integration Tests. Visual Studio offers several different ways of adding these references, however, the simplest way is to edit the test project's .csproj file.
- In the Solution Explorer, right-click the Test Project and select Edit .csproj in the middle of the context menu.