public void Ctor_UnicodeRanges()
        {
            // Act
            var filter = new TextEncoderSettings(UnicodeRanges.LatinExtendedA, UnicodeRanges.LatinExtendedC);

            // Assert
            for (int i = 0; i < 0x0100; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
            for (int i = 0x0100; i <= 0x017F; i++)
            {
                Assert.True(filter.IsCharacterAllowed((char)i));
            }
            for (int i = 0x0180; i < 0x2C60; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
            for (int i = 0x2C60; i <= 0x2C7F; i++)
            {
                Assert.True(filter.IsCharacterAllowed((char)i));
            }
            for (int i = 0x2C80; i <= char.MaxValue; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
        }
        public void AllowChar()
        {
            // Arrange
            var filter = new TextEncoderSettings();

            filter.AllowCharacter('\u0100');

            // Assert
            Assert.True(filter.IsCharacterAllowed('\u0100'));
            Assert.False(filter.IsCharacterAllowed('\u0101'));
        }
        public void ForbidChars_String()
        {
            // Arrange
            var filter = new TextEncoderSettings(UnicodeRanges.BasicLatin);

            filter.ForbidCharacters('x', 'z');

            // Assert
            Assert.True(filter.IsCharacterAllowed('w'));
            Assert.False(filter.IsCharacterAllowed('x'));
            Assert.True(filter.IsCharacterAllowed('y'));
            Assert.False(filter.IsCharacterAllowed('z'));
        }
        public void ForbidRange()
        {
            // Arrange
            var filter = new TextEncoderSettings(new OddTextEncoderSettings());

            filter.ForbidRange(UnicodeRanges.Specials);

            // Assert
            for (int i = 0; i <= 0xFFEF; i++)
            {
                Assert.Equal((i % 2) == 1, filter.IsCharacterAllowed((char)i));
            }
            for (int i = 0xFFF0; i <= char.MaxValue; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
        }
        public void AllowFilter()
        {
            // Arrange
            var filter = new TextEncoderSettings(UnicodeRanges.BasicLatin);

            filter.AllowCodePoints(new OddTextEncoderSettings().GetAllowedCodePoints());

            // Assert
            for (int i = 0; i <= 0x007F; i++)
            {
                Assert.True(filter.IsCharacterAllowed((char)i));
            }
            for (int i = 0x0080; i <= char.MaxValue; i++)
            {
                Assert.Equal((i % 2) == 1, filter.IsCharacterAllowed((char)i));
            }
        }
        public void Ctor_OtherTextEncoderSettingsAsConcreteType_Clones()
        {
            // Arrange
            var originalFilter = new TextEncoderSettings();

            originalFilter.AllowCharacter('x');

            // Act
            var newFilter = new TextEncoderSettings(originalFilter);

            newFilter.AllowCharacter('y');

            // Assert
            Assert.True(originalFilter.IsCharacterAllowed('x'));
            Assert.False(originalFilter.IsCharacterAllowed('y'));
            Assert.True(newFilter.IsCharacterAllowed('x'));
            Assert.True(newFilter.IsCharacterAllowed('y'));
        }
        public void AllowRange()
        {
            // Arrange
            var filter = new TextEncoderSettings();

            filter.AllowRange(UnicodeRanges.LatinExtendedA);

            // Assert
            for (int i = 0; i < 0x0100; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
            for (int i = 0x0100; i <= 0x017F; i++)
            {
                Assert.True(filter.IsCharacterAllowed((char)i));
            }
            for (int i = 0x0180; i <= char.MaxValue; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
        }
        public void Ctor_OtherTextEncoderSettingsAsInterface()
        {
            // Arrange
            var originalFilter = new OddTextEncoderSettings();

            // Act
            var newFilter = new TextEncoderSettings(originalFilter);

            // Assert
            for (int i = 0; i <= char.MaxValue; i++)
            {
                Assert.Equal((i % 2) == 1, newFilter.IsCharacterAllowed((char)i));
            }
        }
        public void Clear()
        {
            // Arrange
            var filter = new TextEncoderSettings();

            for (int i = 1; i <= char.MaxValue; i++)
            {
                filter.AllowCharacter((char)i);
            }

            // Act
            filter.Clear();

            // Assert
            for (int i = 0; i <= char.MaxValue; i++)
            {
                Assert.False(filter.IsCharacterAllowed((char)i));
            }
        }