public void ForbidChar() { // Arrange var filter = new CodePointFilter(UnicodeRanges.BasicLatin); // Act var retVal = filter.ForbidChar('x'); // Assert Assert.Same(filter, retVal); // returns 'this' instance Assert.True(filter.IsCharacterAllowed('w')); Assert.False(filter.IsCharacterAllowed('x')); Assert.True(filter.IsCharacterAllowed('y')); Assert.True(filter.IsCharacterAllowed('z')); }
public void GetAllowedCodePoints() { // Arrange var expected = Enumerable.Range(UnicodeRanges.BasicLatin.FirstCodePoint, UnicodeRanges.BasicLatin.RangeSize) .Concat(Enumerable.Range(UnicodeRanges.Specials.FirstCodePoint, UnicodeRanges.Specials.RangeSize)) .Except(new int[] { 'x' }) .OrderBy(i => i) .ToArray(); var filter = new CodePointFilter(UnicodeRanges.BasicLatin, UnicodeRanges.Specials); filter.ForbidChar('x'); // Act var retVal = filter.GetAllowedCodePoints().OrderBy(i => i).ToArray(); // Assert Assert.Equal <int>(expected, retVal); }
public void GetAllowedCodePoints() { // Arrange var expected = Enumerable.Range(UnicodeRanges.BasicLatin.FirstCodePoint, UnicodeRanges.BasicLatin.RangeSize) .Concat(Enumerable.Range(UnicodeRanges.Specials.FirstCodePoint, UnicodeRanges.Specials.RangeSize)) .Except(new int[] { 'x' }) .OrderBy(i => i) .ToArray(); var filter = new CodePointFilter(UnicodeRanges.BasicLatin, UnicodeRanges.Specials); filter.ForbidChar('x'); // Act var retVal = filter.GetAllowedCodePoints().OrderBy(i => i).ToArray(); // Assert Assert.Equal<int>(expected, retVal); }