You've been given a .NET 8.0 REST API codebase for a fleet vehicle management system. This API is part of a telematics platform that tracks vehicles, their connections to data providers, and trip information.
Your task: Find and fix the bugs in this codebase.
45-60 minutes
This codebase has several issues that need to be fixed:
- Compile Errors - The project won't build
- Runtime Errors - Some operations will crash
- Logical Errors - Some features don't work correctly
cd ManifoldInterviewTest
dotnet buildYou'll see compile errors. Start by fixing these.
Once compiled, run the application:
dotnet runThe API will start and show you available endpoints. Swagger UI is available at the root URL.
Use Swagger UI or any HTTP client to test the endpoints and discover runtime issues.
Look for logical errors in the business logic - things that compile and run but don't work correctly.
ManifoldInterviewTest/
├── Controllers/
│ └── VehicleController.cs # REST API endpoints
├── Services/
│ ├── IVehicleService.cs # Service interface
│ └── VehicleService.cs # Business logic
├── Repository/
│ ├── IVehicleRepository.cs # Repository interface
│ └── VehicleRepository.cs # Data access with caching
├── Models/
│ ├── Vehicle.cs # Vehicle entity
│ ├── Connection.cs # Provider connection entity
│ ├── Trip.cs # Trip entity
│ └── VehicleDto.cs # Data transfer objects
├── Data/
│ └── FleetDbContext.cs # EF Core database context
└── Program.cs # Application startup & DI
No setup required!
The application uses an In-Memory database that is automatically seeded with test data:
| Data | Count |
|---|---|
| Connections | 2 (Geotab Fleet, Samsara Fleet) |
| Vehicles | 5 (mixed active/inactive) |
| Trips | 8 |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/vehicle |
Get all vehicles |
| GET | /api/vehicle/{id} |
Get vehicle by ID |
| GET | /api/vehicle/connection/{id} |
Get vehicles by connection |
| GET | /api/vehicle/statistics |
Get fleet statistics |
| GET | /api/vehicle/active |
Get active vehicles |
| POST | /api/vehicle |
Create a new vehicle |
| PUT | /api/vehicle/{id} |
Update a vehicle |
| DELETE | /api/vehicle/{id} |
Delete a vehicle |
- .NET 8.0 with C# 12
- Entity Framework Core 8.0 (In-Memory provider)
- ASP.NET Core Web API
- IMemoryCache for caching
- Primary Constructors for dependency injection
- Debugging Skills - Can you identify and fix different types of errors?
- Code Comprehension - Do you understand the patterns used (Repository, Service, DI)?
- Attention to Detail - Can you spot subtle logical issues?
- Communication - Can you explain what's wrong and why?
- You may use any IDE features (IntelliSense, debugger, refactoring tools)
- You may search documentation online
- You may ask clarifying questions about requirements
- Focus on finding and fixing bugs, not refactoring or adding features
At the end of the session, be prepared to:
- Show your fixed code that compiles and runs
- Explain each bug you found and how you fixed it
- Discuss any additional issues you noticed but didn't have time to fix
Use these test scenarios to verify your fixes are working correctly. Each scenario tests specific functionality.
Request:
GET /api/vehicle
Expected: Returns a list of 5 vehicles with all fields populated including connectionName.
Request:
GET /api/vehicle/2
Expected: Returns vehicle with ID 2, including the connectionName field.
Request:
GET /api/vehicle/999
Expected: Returns 404 Not Found with message "Vehicle with ID 999 not found".
Request:
GET /api/vehicle/connection/1
Expected: Returns only vehicles that belong to connection ID 1 (not all other vehicles).
Request:
POST /api/vehicle
Content-Type: application/json
{
"vin": "WDB1234567890AAAA",
"licensePlate": "TEST-001",
"connectionId": 1
}
Expected: Returns 201 Created with the new vehicle data.
Test duplicate VIN:
POST /api/vehicle
Content-Type: application/json
{
"vin": "1HGBH41JXMN109186",
"licensePlate": "DUP-001",
"connectionId": 1
}
Expected: Should return 400 Bad Request if VIN already exists in database.
Request:
PUT /api/vehicle/1
Content-Type: application/json
{
"licensePlate": "UPDATED-001",
"isActive": false
}
Expected: Returns the updated vehicle with new license plate and isActive=false.
Test partial update (only isActive):
PUT /api/vehicle/1
Content-Type: application/json
{
"isActive": true
}
Expected: Should only update isActive, keeping the existing licensePlate unchanged.
Request:
DELETE /api/vehicle/1
Expected: Returns 204 No Content.
Verify deletion:
GET /api/vehicle/1
Expected: Returns 404 Not Found after deletion.
Request:
GET /api/vehicle/statistics
Expected Response:
{
"totalVehicles": 5,
"activeVehicles": 3,
"totalMileage": 125500.5,
"averageMileagePerVehicle": 25100.1
}Edge case: What happens if all vehicles are deleted? The endpoint should handle empty data gracefully.
Request:
GET /api/vehicle/active?daysInactive=7
Expected: Returns vehicles that have been seen within the last 7 days AND are marked as active.
Test with default parameter:
GET /api/vehicle/active
Expected: Should return a sensible default result (think about what daysInactive=0 means).
Test with negative value:
GET /api/vehicle/active?daysInactive=-5
Expected: Should handle invalid input appropriately.
- Call
GET /api/vehicle/1- note the response - Call
PUT /api/vehicle/1with updated data - Call
GET /api/vehicle/1again Expected: Should return the updated data.
Request:
GET /api/vehicle/2
Expected: The connectionName field should contain the actual connection name (e.g., "Geotab Fleet" or "Samsara Fleet"), not null or empty.
{
"id": 1,
"vin": "WDB1234567890AAAA",
"licensePlate": "ABC-1234",
"connectionName": "Geotab Fleet",
"isActive": true,
"lastSeenAt": "2024-12-01T10:30:00Z",
"totalMileage": 15420.5,
"tripCount": 12
}{
"totalVehicles": 5,
"activeVehicles": 3,
"totalMileage": 125500.5,
"averageMileagePerVehicle": 25100.1
}Vehicle with ID {id} not found
VIN is required
Take your time to understand the code before making changes. Quality matters more than quantity - it's better to thoroughly fix a few issues than to partially fix many.
If you have questions about the requirements or expected behavior, please ask!