Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshjohanning/primeservice-unit-testing-using-dotnet-test
https://github.com/joshjohanning/primeservice-unit-testing-using-dotnet-test
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/joshjohanning/primeservice-unit-testing-using-dotnet-test
- Owner: joshjohanning
- Created: 2021-09-03T15:47:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-18T19:03:43.000Z (11 months ago)
- Last Synced: 2024-10-14T09:47:40.044Z (3 months ago)
- Language: C#
- Size: 35.2 KB
- Stars: 1
- Watchers: 1
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# forked from
Forked from: https://github.com/dotnet/samples/tree/6627c7fbfb70a97362e83544b29dd3fab0bd9a5f/core/getting-started/unit-testing-using-dotnet-test
# Unit testing using dotnet test sample
This sample is part of the [unit testing tutorial](https://docs.microsoft.com/dotnet/core/testing/unit-testing-with-dotnet-test) for creating applications with unit tests included. See that topic for detailed steps on the code for this sample.
## Key features
This sample demonstrates creating a library and writing effective unit tests that validate the features in that library. The example provides a service that indicates whether a number is prime.
## Restore and test
To run the tests, navigate to the *PrimeService.Tests* directory and type the following commands:
```
dotnet restore
dotnet test
````dotnet restore` restores the packages of both projects.
`dotnet test` builds both projects and runs all of the configured tests.
**Note:** Starting with .NET Core 2.0 SDK, you don't have to run [`dotnet restore`](https://docs.microsoft.com/dotnet/core/tools/dotnet-restore) because it's run implicitly by all commands that require a restore to occur, such as `dotnet new`, `dotnet build` and `dotnet run`.
It's still a valid command in certain scenarios where doing an explicit restore makes sense, such as [continuous integration builds in Azure DevOps Services](https://docs.microsoft.com/azure/devops/build-release/apps/aspnet/build-aspnet-core) or in build systems that need to explicitly control the time at which the restore occurs.