diff --git a/devDocs/New API Checklist.md b/devDocs/New API Checklist.md index 7227dd1..3943882 100644 --- a/devDocs/New API Checklist.md +++ b/devDocs/New API Checklist.md @@ -3,6 +3,7 @@ When adding or updating a new API: 1. Tests + 1. Overwrite tests too 1. Update public API check 1. Bump version 1. Code coverage diff --git a/src/ZeroRedact.Benchmark/SimpleRedactionBenchmarks.cs b/src/ZeroRedact.Benchmark/SimpleRedactionBenchmarks.cs index e6e73ba..9b5120d 100644 --- a/src/ZeroRedact.Benchmark/SimpleRedactionBenchmarks.cs +++ b/src/ZeroRedact.Benchmark/SimpleRedactionBenchmarks.cs @@ -1,10 +1,5 @@ using BenchmarkDotNet.Attributes; -using System; -using System.Collections.Generic; -using System.Linq; using System.Text; -using System.Threading.Tasks; -using ZeroRedact.Benchmark.Redactors; namespace ZeroRedact.Benchmark { diff --git a/src/ZeroRedact.UnitTest/Redactors/CheckForOverwriteTests.cs b/src/ZeroRedact.UnitTest/Redactors/CheckForOverwriteTests.cs index eef3ae3..9670e90 100644 --- a/src/ZeroRedact.UnitTest/Redactors/CheckForOverwriteTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/CheckForOverwriteTests.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using static System.Net.Mime.MediaTypeNames; - -namespace ZeroRedact.UnitTest.Redactors +namespace ZeroRedact.UnitTest.Redactors { // Tests to ensure that the redactors aren't manipulating the input data itself // https://stackoverflow.com/a/10779478 @@ -786,5 +778,23 @@ public void CheckForOverwrite_String_IgnoreSymbols() // Assert Assert.AreEqual(expected, input); } + + [TestMethod] + public void CheckForOverwrite_String_ShowFirstAndLast() + { + // Arrange + var redactor = new Redactor(); + var input = "Hello, world!"; + var expected = new string(input.ToArray()); + + // Act + _ = redactor.RedactString(input, new StringRedactorOptions + { + RedactorType = StringRedaction.ShowFirstAndLast + }); + + // Assert + Assert.AreEqual(expected, input); + } } } diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactCreditCardTests.cs b/src/ZeroRedact.UnitTest/Redactors/RedactCreditCardTests.cs index d23b1a1..5f71f9e 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactCreditCardTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactCreditCardTests.cs @@ -25,7 +25,7 @@ private static IEnumerable All_TestData() yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -79,7 +79,7 @@ private static IEnumerable Full_TestData() yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -106,7 +106,7 @@ private static IEnumerable ShowLastFour_TestData() yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -134,13 +134,14 @@ private static IEnumerable ShowFirstSixLastFour_TestData() yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; } + [TestMethod] [DynamicData(nameof(All_TestData), DynamicDataSourceType.Method)] public void RedactCreditCard_All_ShouldReturnRedactedCreditCard_String(string input, string expected) diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactDateTests.cs b/src/ZeroRedact.UnitTest/Redactors/RedactDateTests.cs index d96925b..426b651 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactDateTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactDateTests.cs @@ -15,6 +15,7 @@ public void Setup() { _redactor = new Redactor(); } + private static IEnumerable All_TestData() { yield return new object[] { null, 2023, 1, 1, "**********" }; @@ -37,6 +38,7 @@ private static IEnumerable All_TestData() yield return new object[] { "ja-JP", 2023, 11, 1, "**********" }; yield return new object[] { "ja-JP", 2023, 12, 31, "**********" }; } + private static IEnumerable FixedLength_TestData() { yield return new object[] { null, 2023, 1, 1, "********" }; @@ -82,6 +84,7 @@ private static IEnumerable Full_TestData() yield return new object[] { "ja-JP", 2023, 11, 1, "****/**/**" }; yield return new object[] { "ja-JP", 2023, 12, 31, "****/**/**" }; } + private static IEnumerable Day_TestData() { yield return new object[] { null, 2023, 1, 1, "01/**/2023" }; @@ -127,6 +130,7 @@ private static IEnumerable Month_TestData() yield return new object[] { "ja-JP", 2023, 11, 1, "2023/**/01" }; yield return new object[] { "ja-JP", 2023, 12, 31, "2023/**/31" }; } + private static IEnumerable Year_TestData() { yield return new object[] { null, 2023, 1, 1, "01/01/****" }; @@ -149,6 +153,7 @@ private static IEnumerable Year_TestData() yield return new object[] { "ja-JP", 2023, 11, 1, "****/11/01" }; yield return new object[] { "ja-JP", 2023, 12, 31, "****/12/31" }; } + private static IEnumerable DayAndMonth_TestData() { yield return new object[] { null, 2023, 1, 1, "**/**/2023" }; @@ -171,6 +176,7 @@ private static IEnumerable DayAndMonth_TestData() yield return new object[] { "ja-JP", 2023, 11, 1, "2023/**/**" }; yield return new object[] { "ja-JP", 2023, 12, 31, "2023/**/**" }; } + private static IEnumerable MonthAndYear_TestData() { yield return new object[] { null, 2023, 1, 1, "**/01/****" }; diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactEmailAddressTests.cs b/src/ZeroRedact.UnitTest/Redactors/RedactEmailAddressTests.cs index 351854a..b8eb539 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactEmailAddressTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactEmailAddressTests.cs @@ -48,7 +48,7 @@ private static IEnumerable All_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -97,7 +97,7 @@ private static IEnumerable FixedLength_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -146,7 +146,7 @@ private static IEnumerable Full_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -195,7 +195,7 @@ private static IEnumerable Username_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -244,7 +244,7 @@ private static IEnumerable HalfUsername_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -293,7 +293,7 @@ private static IEnumerable Middle_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -342,7 +342,7 @@ private static IEnumerable MostUsername_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -391,13 +391,14 @@ private static IEnumerable ShowFirstCharacters_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; } + [TestMethod] [DynamicData(nameof(All_TestData), DynamicDataSourceType.Method)] public void RedactEmailAddressAddress_All_ShouldReturnRedactedEmailAddress_String(string input, string expected) diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactEmailAddressWithMailAddressClass.cs b/src/ZeroRedact.UnitTest/Redactors/RedactEmailAddressWithMailAddressClass.cs index 83dc029..8fe509b 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactEmailAddressWithMailAddressClass.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactEmailAddressWithMailAddressClass.cs @@ -34,6 +34,7 @@ private static IEnumerable All_TestData() yield return new object[] { "Abc..123@example.com", "********************" }; yield return new object[] { "just”not”right@example.com", "**************************" }; } + private static IEnumerable FixedLength_TestData() { yield return new object[] { "email@example.com", "********" }; diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactIPv4AddressTests.cs b/src/ZeroRedact.UnitTest/Redactors/RedactIPv4AddressTests.cs index 0e442fd..3028f8a 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactIPv4AddressTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactIPv4AddressTests.cs @@ -407,6 +407,7 @@ private static IEnumerable ShowLastOctet_TestData() yield return new object[] { "abc123 !@#", "********" }; } + [TestMethod] [DynamicData(nameof(All_TestData), DynamicDataSourceType.Method)] public void RedactIpv4_All_ShouldReturnRedactedRedactIPv4_String(string input, string expected) diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactIPv6AddressTests.cs b/src/ZeroRedact.UnitTest/Redactors/RedactIPv6AddressTests.cs index 2e588d4..9cb3ab2 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactIPv6AddressTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactIPv6AddressTests.cs @@ -15,12 +15,13 @@ private static IEnumerable All_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "***********************" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; } + private static IEnumerable FixedLength_TestData() { yield return new object[] { "", "" }; @@ -33,12 +34,13 @@ private static IEnumerable FixedLength_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; } + private static IEnumerable Full_TestData() { yield return new object[] { "", "" }; @@ -52,12 +54,13 @@ private static IEnumerable Full_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "**:**:**:**:**:**:**:**" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; } + private static IEnumerable ShowLastQuartet_TestData() { yield return new object[] { "", "" }; @@ -71,12 +74,13 @@ private static IEnumerable ShowLastQuartet_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "**:**:**:**:**:**:**:5E" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; } + [TestMethod] [DynamicData(nameof(All_TestData), DynamicDataSourceType.Method)] public void RedactIpv6_All_ShouldReturnRedactedRedactIPv6_String(string input, string expected) diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactMACAddressTests.cs b/src/ZeroRedact.UnitTest/Redactors/RedactMACAddressTests.cs index 31e437c..a8c5487 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactMACAddressTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactMACAddressTests.cs @@ -14,7 +14,7 @@ private static IEnumerable All_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "***************************************" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; @@ -31,7 +31,7 @@ private static IEnumerable FixedLength_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; @@ -48,7 +48,7 @@ private static IEnumerable Full_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "****:****:****:****:****:****:****:****" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; @@ -65,7 +65,7 @@ private static IEnumerable ShowLastByte_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "****:****:****:****:****:****:****:7334" }; yield return new object[] { "+1 (555) 123-4567", "********" }; yield return new object[] { "abc123 !@#", "********" }; diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactPhoneNumberTests.cs b/src/ZeroRedact.UnitTest/Redactors/RedactPhoneNumberTests.cs index a646b28..10103e8 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactPhoneNumberTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactPhoneNumberTests.cs @@ -95,7 +95,7 @@ private static IEnumerable FixedLength_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "abc123 !@#", "********" }; diff --git a/src/ZeroRedact.UnitTest/Redactors/RedactStringTests.cs b/src/ZeroRedact.UnitTest/Redactors/RedactStringTests.cs index 7cf7741..198c9d1 100644 --- a/src/ZeroRedact.UnitTest/Redactors/RedactStringTests.cs +++ b/src/ZeroRedact.UnitTest/Redactors/RedactStringTests.cs @@ -46,7 +46,7 @@ private static IEnumerable FixedLength_TestData() yield return new object[] { "4111 1111 1111 1111", "********" }; yield return new object[] { "2023/06/15", "********" }; yield return new object[] { "email@example.com", "********" }; - yield return new object[] { "100.100.100.100", "********"}; + yield return new object[] { "100.100.100.100", "********" }; yield return new object[] { "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "********" }; yield return new object[] { "00:1A:2B:FF:FE:3C:4D:5E", "********" }; yield return new object[] { "+1 (555) 123-4567", "********" }; @@ -216,7 +216,6 @@ public void RedactString_SecondHalf_ShouldReturnRedactedString_ReadOnlySpan(stri Assert.AreEqual(expected, result.ToString()); } - [TestMethod] [DynamicData(nameof(IgnoreSymbols_TestData), DynamicDataSourceType.Method)] public void RedactString_IgnoreSymbols_ShouldReturnCorrectString_String(string input, string expected) @@ -245,7 +244,7 @@ public void RedactString_ShowFirstAndLast_ShouldReturnCorrectString_String(strin { // Act string result = _redactor.RedactString(input, new StringRedactorOptions { RedactorType = StringRedaction.ShowFirstAndLast }); - + // Assert Assert.AreEqual(expected, result); } @@ -256,7 +255,7 @@ public void RedactString_ShowFirstAndLast_ShouldReturnCorrectString_ReadOnlySpan { // Act ReadOnlySpan result = _redactor.RedactString(input.AsSpan(), new StringRedactorOptions { RedactorType = StringRedaction.ShowFirstAndLast }); - + // Assert Assert.AreEqual(expected, result.ToString()); } diff --git a/src/ZeroRedact/Redactors/Redactor.EmailAddress.cs b/src/ZeroRedact/Redactors/Redactor.EmailAddress.cs index c992d92..d000870 100644 --- a/src/ZeroRedact/Redactors/Redactor.EmailAddress.cs +++ b/src/ZeroRedact/Redactors/Redactor.EmailAddress.cs @@ -213,7 +213,7 @@ private unsafe string CreateMostUsernameRedaction(ReadOnlySpan emailAddres outputBuffer[..finalAtIndex].Fill(state.RedactionCharacter); outputBuffer[0] = username[0]; - outputBuffer[username.Length - 1] = username[username.Length - 1]; + outputBuffer[username.Length - 1] = username[username.Length - 1]; domain.CopyTo(outputBuffer[finalAtIndex..]); }); diff --git a/src/ZeroRedact/Redactors/Redactor.String.cs b/src/ZeroRedact/Redactors/Redactor.String.cs index ff63a57..4c6a75f 100644 --- a/src/ZeroRedact/Redactors/Redactor.String.cs +++ b/src/ZeroRedact/Redactors/Redactor.String.cs @@ -123,7 +123,7 @@ private unsafe string CreateShowFirstAndLastRedaction(ReadOnlySpan value, var result = string.Create(value.Length, redactorState, static (outputBuffer, state) => { var input = new Span(state.StartPointer.ToPointer(), outputBuffer.Length); - + outputBuffer.Fill(state.RedactionCharacter); outputBuffer[0] = input[0]; outputBuffer[^1] = input[^1]; diff --git a/src/ZeroRedact/Validators/PhoneNumberValidator.cs b/src/ZeroRedact/Validators/PhoneNumberValidator.cs index c5b9bdd..0a6263a 100644 --- a/src/ZeroRedact/Validators/PhoneNumberValidator.cs +++ b/src/ZeroRedact/Validators/PhoneNumberValidator.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ZeroRedact.Validators +namespace ZeroRedact.Validators { internal class PhoneNumberValidator {