Dot net Cli Flashcards
To create a new dot net solution
dotnet new sln
to create the source project
dotnet new classlib
To add project to a solution
dotnet sln add PrimeService/PrimeService.csproj to add the class library project to the solution.
Create the test project
dotnet new mstest
The dotnet new command creates a test project that uses MSTest as the test library. The generated template configures the test runner in the PrimeServiceTests.csproj file:
XML
Copy
he test project requires other packages to create and run unit tests. dotnet new in the previous step added the MSTest SDK, the MSTest test framework, and the MSTest runner.
Add Reference to a project
Now, add the PrimeService class library as another dependency to the project. Use the dotnet add reference command:
.NET Core CLI
Copy
dotnet add reference ../PrimeService/PrimeService.csproj
To Run Tests
The dotnet test command runs a build for the PrimeService project and then for the PrimeService.Tests project. After building both projects, it runs this single test. It passes.