Beispiel #1
0
        static Helpers()
        {
            var encoderSettings = new TextEncoderSettings(UnicodeRanges.All);

            encoderSettings.ForbidCharacters('*', '_', '`');
            TelegramMarkdownEncoder = HtmlEncoder.Create(encoderSettings);
        }
        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 ForbidChars_Null()
        {
            TextEncoderSettings filter = new TextEncoderSettings(UnicodeRanges.BasicLatin);

            Assert.Throws <ArgumentNullException>("characters", () => filter.ForbidCharacters(null));
        }