Skip to content

afzal-tech-solutions/UnitTestingCourse

Repository files navigation

NUnit Test Sample Project

Overview

This project demonstrates how to write and execute unit tests using NUnit in a .NET application. It is designed as a learning resource for developers who want to understand unit testing concepts, best practices, and test automation techniques in C#.

The solution includes a sample application with business logic and a separate test project containing NUnit test cases that validate functionality, edge cases, and error handling.

Objectives

Understand unit testing fundamentals

Learn NUnit framework structure and attributes

Practice writing testable code

Implement assertions and test fixtures

Execute and analyze test results

Solution │ ├── SampleApp │ ├── Services │ ├── Models │ └── Utilities │ └── SampleApp.Tests ├── UnitTests ├── TestData └── Helpers

🧪 Technologies Used

.NET (Core / 6 / 7 / 8 depending on your version)

NUnit

NUnit Test Adapter

Microsoft.NET.Test.Sdk

Visual Studio / VS Code

How to Run Tests

Using Visual Studio

Open solution

Build project

Go to Test Explorer

Click Run All

Using CLI

dotnet test

📚 Key NUnit Attributes Used

Attribute Purpose [Test] Marks a method as a test [SetUp] Runs before each test [TearDown] Runs after each test [TestFixture] Defines test class [TestCase] Parameterized test

🚀 Learning Outcomes

After exploring this project, you should be able to:

Write maintainable unit tests

Structure test projects properly

Validate business logic confidently

Integrate tests into CI/CD pipelines

📎 Notes

This project is intended for educational purposes and can be extended with:

Mocking frameworks (Moq, NSubstitute)

Integration tests

Code coverage tools

If you want, I can also provide:

a GitHub-ready version with badges

a beginner version

or a senior-level enterprise test template.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages