2026-07-07 13:05:07 +05:30
|
|
|
using FluentAssertions;
|
|
|
|
|
using PiiRedaction.Core.Models;
|
|
|
|
|
using PiiRedaction.Core.Tests.TestSupport;
|
|
|
|
|
|
|
|
|
|
namespace PiiRedaction.Core.Tests.Integration;
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public sealed class GoldenPromptTests
|
|
|
|
|
{
|
|
|
|
|
[TestCaseSource(typeof(PromptScenarioCatalog), nameof(PromptScenarioCatalog.AllScenarios))]
|
2026-07-07 17:12:38 +05:30
|
|
|
[TestCaseSource(typeof(TamilPromptScenarioCatalog), nameof(TamilPromptScenarioCatalog.AllScenarios))]
|
2026-07-07 13:05:07 +05:30
|
|
|
public void Sanitize_PromptScenario_ProducesExpectedOutput(PromptScenario scenario)
|
|
|
|
|
{
|
|
|
|
|
var sanitizer = ProductionPipelineFactory.CreateForScenario(scenario);
|
|
|
|
|
var result = sanitizer.Sanitize(new SanitizationRequest(scenario.Prompt));
|
|
|
|
|
|
|
|
|
|
result.SanitizedPrompt.Should().Be(scenario.ExpectedSanitized, because: scenario.Name);
|
|
|
|
|
result.DetectedEntities.Select(entity => entity.Type)
|
|
|
|
|
.Should().BeEquivalentTo(scenario.ExpectedTypes, because: scenario.Name);
|
|
|
|
|
|
|
|
|
|
foreach (var forbidden in scenario.MustNotContainInSanitized)
|
|
|
|
|
{
|
|
|
|
|
result.SanitizedPrompt.Should().NotContain(forbidden, because: scenario.Name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|