Skip to content

[2pts] Write unit tests — combat system #19

@github-actions

Description

@github-actions

Description

Create comprehensive unit tests for combat system components.

Depends on: ICombatStrategy and CombatEngine issues

Test Coverage

ICombatStrategy Tests

  • Test each strategy (Melee, Magic, Ranged)
  • Verify damage calculation formulas
  • Test with various attack and defense values
  • Test edge cases

CombatEngine Tests

  • Test RunCombat() method
  • Player wins scenario
  • Enemy wins scenario
  • Verify correct XP returned
  • Verify correct Gold returned
  • Test turn order (player attacks first)

Edge Cases to Cover

  • Zero health
  • Maximum defense (damage reduction)
  • Zero attack power
  • Negative values (should not occur)

Requirements

  • Use xUnit testing framework
  • Use seeded Random for deterministic tests
  • All tests must pass in CI pipeline
  • Good test naming conventions

Acceptance Criteria

  • Test class for ICombatStrategy implementations
  • MeleeStrategy damage calculation tested
  • MagicStrategy damage calculation tested
  • RangedStrategy damage calculation tested
  • Test class for CombatEngine
  • Player wins scenario tested
  • Enemy wins scenario tested
  • XP reward calculation tested
  • Gold reward calculation tested
  • Turn order verified
  • Edge cases tested (zero health, max defense, zero attack)
  • Uses seeded Random for deterministic behavior
  • All tests pass in CI
  • Tests follow naming conventions

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions