55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
|
|
using FluentAssertions;
|
||
|
|
using PiiRedaction.Core.Detection;
|
||
|
|
using PiiRedaction.Infrastructure.Onnx;
|
||
|
|
|
||
|
|
namespace PiiRedaction.Core.Tests.Detection;
|
||
|
|
|
||
|
|
[TestFixture]
|
||
|
|
public sealed class ScriptRouterTests
|
||
|
|
{
|
||
|
|
private readonly ScriptRouter _router = new();
|
||
|
|
|
||
|
|
[Test]
|
||
|
|
public void GetComposition_LatinOnly_ReturnsLatinOnly()
|
||
|
|
{
|
||
|
|
_router.GetComposition("Customer Ravi Kumar called about billing.")
|
||
|
|
.Should().Be(ScriptComposition.LatinOnly);
|
||
|
|
}
|
||
|
|
|
||
|
|
[Test]
|
||
|
|
public void GetComposition_TamilOnly_ReturnsTamilOnly()
|
||
|
|
{
|
||
|
|
_router.GetComposition("வாடிக்கையாளர் ராஜேஷ் தொலைபேசி 9876543210")
|
||
|
|
.Should().Be(ScriptComposition.TamilOnly);
|
||
|
|
}
|
||
|
|
|
||
|
|
[Test]
|
||
|
|
public void GetComposition_Mixed_ReturnsMixed()
|
||
|
|
{
|
||
|
|
_router.GetComposition("Rajesh மற்றும் Priya disputed the charge.")
|
||
|
|
.Should().Be(ScriptComposition.Mixed);
|
||
|
|
}
|
||
|
|
|
||
|
|
[Test]
|
||
|
|
public void GetComposition_MixedTamilEnglishSample_ReturnsMixed()
|
||
|
|
{
|
||
|
|
_router.GetComposition("வாடிக்கையாளர் Ravi Kumar phone 9876543210 disputed the charge.")
|
||
|
|
.Should().Be(ScriptComposition.Mixed);
|
||
|
|
}
|
||
|
|
|
||
|
|
[Test]
|
||
|
|
public void GetComposition_NoLetters_ReturnsNoLetters()
|
||
|
|
{
|
||
|
|
_router.GetComposition("9876543210 12345")
|
||
|
|
.Should().Be(ScriptComposition.NoLetters);
|
||
|
|
}
|
||
|
|
|
||
|
|
[Test]
|
||
|
|
public void GetComposition_TamilBoundaryChars_AreClassifiedAsTamil()
|
||
|
|
{
|
||
|
|
_router.GetComposition("\u0B80").Should().Be(ScriptComposition.TamilOnly);
|
||
|
|
_router.GetComposition("\u0BFF").Should().Be(ScriptComposition.TamilOnly);
|
||
|
|
_router.GetComposition("A").Should().Be(ScriptComposition.LatinOnly);
|
||
|
|
}
|
||
|
|
}
|