Skip to content

Write unit tests for ScoringEngine and RedFlagAnalyzer #3

@Aftab553911

Description

@Aftab553911

Overview

The core logic in ScoringEngine.cs and RedFlagAnalyzer.cs has
no unit tests. This makes it risky to change scoring logic
without knowing if something broke.

What needs to be done

Create a new test project JobTruth.Tests and write xUnit tests.

Setup

cd JobTruth
dotnet new xunit -n JobTruth.Tests
dotnet sln add JobTruth.Tests/JobTruth.Tests.csproj
cd JobTruth.Tests
dotnet add reference ../JobTruth.API/JobTruth.API.csproj

Tests needed

ScoringEngine tests

  • Score starts at 100
  • FAIL check deducts correct points
  • Score never goes below 0
  • Verdict is "Looks Legitimate" when score >= 80
  • Verdict is "Proceed with Caution" when score 50-79
  • Verdict is "High Risk" when score < 50

RedFlagAnalyzer tests

  • Returns PASS when description is clean
  • Detects "registration fee" pattern
  • Detects "whatsapp your cv" pattern
  • Deduction is capped at 40 points
  • Returns FAIL when 3+ flags found

Acceptance criteria

  • New JobTruth.Tests project created
  • At least 15 unit tests written
  • All tests pass with dotnet test
  • Test coverage for ScoringEngine and RedFlagAnalyzer

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingWrite Test for Verification

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions