Пример #1
0
        public void HtmlEncode_PositiveTestCase()
        {
            // Arrange
            HtmlEncoder  encoder = HtmlEncoder.Create(UnicodeRanges.All);
            StringWriter writer  = new StringWriter();

            // Act
            encoder.Encode(writer, "Hello+there!");

            // Assert
            Assert.Equal("Hello+there!", writer.ToString());
        }
Пример #2
0
        public void HtmlEncode_PositiveTestCase_CreateWithSettings()
        {
            // Arrange
            TextEncoderSettings settings = new TextEncoderSettings(UnicodeRanges.All);
            HtmlEncoder         encoder  = HtmlEncoder.Create(settings);
            StringWriter        writer   = new StringWriter();

            // Act
            encoder.Encode(writer, "Hello+there!");

            // Assert
            Assert.Equal("Hello+there!", writer.ToString());
        }
Пример #3
0
 public void HtmlEncode_CreateNullSettings()
 {
     Assert.Throws <ArgumentNullException>("settings", () => HtmlEncoder.Create(default(TextEncoderSettings)));
 }
Пример #4
0
 public void HtmlEncode_CreateNullRanges()
 {
     Assert.Throws <ArgumentNullException>("allowedRanges", () => HtmlEncoder.Create(default(UnicodeRange[])));
 }