NEO-104: Use subset check for all-targets-defeated predicate.
Matches documented semantics; extra defeated ids via direct store calls no longer block completion readiness (Bugbot PR #143).pull/143/head
parent
91f74b7d6e
commit
0289930897
|
|
@ -180,6 +180,28 @@ public sealed class EncounterProgressOperationsTests
|
||||||
Assert.True(allDefeated);
|
Assert.True(allDefeated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task IsAllRequiredTargetsDefeated_ShouldReturnTrue_WhenDefeatedSetIsSupersetOfRequired()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
await using var factory = new InMemoryWebApplicationFactory();
|
||||||
|
var registry = factory.Services.GetRequiredService<IEncounterDefinitionRegistry>();
|
||||||
|
var progress = factory.Services.GetRequiredService<IEncounterProgressStore>();
|
||||||
|
_ = progress.TryActivate(PlayerId, EncounterId);
|
||||||
|
_ = progress.TryAddDefeatedTarget(PlayerId, EncounterId, MeleeNpc);
|
||||||
|
_ = progress.TryAddDefeatedTarget(PlayerId, EncounterId, RangedNpc);
|
||||||
|
_ = progress.TryAddDefeatedTarget(PlayerId, EncounterId, EliteNpc);
|
||||||
|
_ = progress.TryAddDefeatedTarget(PlayerId, EncounterId, "extra_non_required_npc");
|
||||||
|
// Act
|
||||||
|
var allDefeated = EncounterProgressOperations.IsAllRequiredTargetsDefeated(
|
||||||
|
PlayerId,
|
||||||
|
EncounterId,
|
||||||
|
registry,
|
||||||
|
progress);
|
||||||
|
// Assert
|
||||||
|
Assert.True(allDefeated);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task TryMarkCompleted_ShouldReturnFalseOnSecondAttempt_WhenUsingCompletionStoreDirectly()
|
public async Task TryMarkCompleted_ShouldReturnFalseOnSecondAttempt_WhenUsingCompletionStoreDirectly()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,6 @@ public static class EncounterProgressOperations
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return required.SetEquals(progress.DefeatedNpcInstanceIds);
|
return required.IsSubsetOf(progress.DefeatedNpcInstanceIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue