unit-testing-using-dotnet-test
What did I do
First, I created unit-testing-using-dotnet-test
solution by following command.
$dotnet new sln -o unit-testing-using-dotnet-test
Then, I created class library by following command.
$dotnet new classlib -o PrimeService
And I renamed generated class file.
$mv PrimeService/Class1.cs PrimeService/PrimeService.cs
I modifed PrimeService/PrimeService.cs
to as following.
usingSystem;namespacePrime.Service{publicclassPrimeSercice{publicboolIsPrime(intcadidate){thrownewNotImplementedException("Not implemented.");}}}
In the unit-testing-using-dotnet-test
directory, run the following command to added the class library project to the solution.
$dotnet sln add ./PrimeService/PrimeService.csproj
Created the PrimeService.Tests project by running the following command.
$dotnet new xunit -o PrimeService.Tests
At this point project structure as below.
├── PrimeService
│ ├── PrimeService.cs
│ ├── PrimeService.csproj
│ └── obj
│ ├── PrimeService.csproj.nuget.cache
│ ├── PrimeService.csproj.nuget.dgspec.json
│ ├── PrimeService.csproj.nuget.g.props
│ ├── PrimeService.csproj.nuget.g.targets
│ └── project.assets.json
├── PrimeService.Tests
│ ├── PrimeService.Tests.csproj
│ ├── UnitTest1.cs
│ └── obj
│ ├── PrimeService.Tests.csproj.nuget.cache
│ ├── PrimeService.Tests.csproj.nuget.dgspec.json
│ ├── PrimeService.Tests.csproj.nuget.g.props
│ ├── PrimeService.Tests.csproj.nuget.g.targets
│ └── project.assets.json
└── unit-testing-using-dotnet-test.sln
comming soon...