A C# API testing project demonstrating automated testing of REST APIs using NUnit and FluentAssertions. The project tests the JSONPlaceholder API to retrieve user data.
- .NET SDK 8.0+
- Visual Studio 2022 (optional)
- Clone the repository
- Restore packages:
dotnet restore - Build the solution:
dotnet build - Run tests:
- Command line:
dotnet test - Or open in Visual Studio and run via Test Explorer
- Command line:
- .NET 8
- NUnit
- FluentAssertions
- RestSharp
- HttpClient / System.Net.Http.Json
- System.Text.Json
ApiTestingProject/
├── Models/
│ └── UserModel.cs # User data model
├── Utilities/
│ └── ApiClient.cs # HTTP client for API requests
└── Tests/
└── UserApiTests.cs # NUnit test cases
- GetAllUsers_ShouldReturnSuccessfulResponse — Verifies GET /users returns a non-empty list of users
- GetSingleUser_ShouldReturnCorrectUserDetails — Verifies GET /users/{id} returns the correct user with valid id and name
Tests run automatically on every push and pull request via GitHub Actions. See the badge above for current status.