A sample .NET console application demonstrating the integration and usage of NUnit for unit testing. This repository serves as an educational resource and a starting point for developers who wish to add automated tests to their .NET console projects using NUnit.
ExampleNUnitConsoleApp is designed to help you understand how to create, organize, and execute unit tests in a .NET console application using NUnit. It contains both application code and corresponding test cases, illustrating best practices for test-driven development and continuous integration.
- Simple .NET Console Application
- Example NUnit test project
- Demonstrates common NUnit assertions and test setup/teardown
- Organized and easy-to-read code structure
- Extendable for more complex testing scenarios
- .NET SDK (Core or later)
- NUnit NuGet package
- NUnit3TestAdapter NuGet package (for test discovery in IDEs like Visual Studio)
-
Clone the repository
git clone https://github.com/THADSANAI/ExampleNUnitConsoleApp.git cd ExampleNUnitConsoleApp -
Restore dependencies
dotnet restore
Navigate to the main project directory and run:
dotnet run --project ExampleNUnitConsoleAppTo execute the tests:
dotnet testExampleNUnitConsoleApp/
│
├── ExampleNUnitConsoleApp/ # Main application code
│ ├── Program.cs # Entry point
│ └── ... # Other source files
│
├── ExampleNUnitConsoleApp.Tests/ # NUnit test project
│ ├── ExampleTests.cs # Example test cases
│ └── ... # Additional tests
│
├── README.md
├── .gitignore
└── ... (solution files, configs)
Contributions are welcome!
Feel free to open issues for bugs or suggestions, and submit pull requests for improvements.
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes.
- Open a pull request with a clear description of your changes.
This project is licensed under the MIT License. See LICENSE for details.