コード例 #1
0
        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'));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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'));
        }