File: FakeRedactorProviderTests.cs
Web Access
Project: src\test\Libraries\Microsoft.Extensions.Compliance.Testing.Tests\Microsoft.Extensions.Compliance.Testing.Tests.csproj (Microsoft.Extensions.Compliance.Testing.Tests)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
using Microsoft.Extensions.Compliance.Classification;
using Xunit;
 
namespace Microsoft.Extensions.Compliance.Testing.Tests;
 
public class FakeRedactorProviderTests
{
    [Fact]
    public void Basic()
    {
        var provider = new FakeRedactorProvider();
 
        var dc = new DataClassification("TAX", "1");
        var redactor = provider.GetRedactor(dc);
        Assert.Equal("Hello", redactor.Redact("Hello"));
    }
 
    [Fact]
    public void Can_Access_Event_Collector_From_Within_Redactor_Provider()
    {
        var rp = new FakeRedactorProvider();
        var dc = new DataClassification("TAX", "1");
        rp.GetRedactor(dc);
        Assert.Equal(dc, rp.Collector.LastRedactorRequested.DataClassifications);
    }
}