Skip to content

[2pts] Write unit tests — items and inventory #20

@github-actions

Description

@github-actions

Description

Create comprehensive unit tests for item system and player inventory.

Depends on: Item subclasses and Player issues

Test Coverage

Item Subclass Tests

  • Weapon.Use(): Verify damage bonus applied correctly
  • Armor.Use(): Verify defense bonus applied correctly
  • Potion.Use(): Verify healing applied correctly
  • Potion healing capped at MaxHealth

Player Inventory Tests

  • AddItem() adds item to inventory
  • RemoveItem() removes item from inventory
  • UseItem() applies item effect and removes from inventory
  • Inventory state changes verified

LootResolver Tests

  • Test with injected seed for deterministic drops
  • Verify drop probability calculations
  • Verify Dragon always drops at least one item
  • Verify Gold equals GoldReward

Requirements

  • Use xUnit testing framework
  • Use seeded Random for loot tests
  • Test edge cases (full health, empty inventory, etc.)
  • All tests must pass in CI pipeline

Acceptance Criteria

  • Test class for Item subclasses
  • Weapon.Use() damage bonus tested
  • Armor.Use() defense bonus tested
  • Potion.Use() healing tested
  • Potion healing capped at MaxHealth verified
  • Test class for Player inventory operations
  • AddItem() tested
  • RemoveItem() tested
  • UseItem() tested
  • Inventory state changes verified
  • Test class for LootResolver
  • Tested with injected seed
  • Drop probability logic verified
  • Dragon loot guarantee tested
  • Gold amount verification tested
  • 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