Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Last active October 14, 2020 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/e8b482ef998564076a4f9f5af412371f to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/e8b482ef998564076a4f9f5af412371f to your computer and use it in GitHub Desktop.
Create test project, add project reference and NuGet package reference
## Go to the directory which contains the web app project
cd D:\BLOG_Samples\FirstWebApp
## Navigate to parent directory of web app project directory
cd ..
## Create directory for test project
mkdir FirstWebApp.Tests
## Move to the test project directory
cd .\FirstWebApp.Tests\
## Create xUnit test proejct of same name (FirstWebApp.Tests)
dotnet new xunit
## Add reference of Web App project to the test project
dotnet add reference ..\FirstWebApp\FirstWebApp.csproj
## Add NuGet package
dotnet add package Microsoft.AspNetCore.TestHost
## Add NuGet package for hosting TestServer
dotnet add package Microsoft.Extensions.Hosting
## Move to the parent directory
cd ..
## Open Visual Studio Code
Code .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment