Ejemplo n.º 1
0
        public void ShouldBuildDisplayTextUsingSpecifiedFormatter()
        {
            // arrange
            var violation = new SampleViolation("AwesomeMethod");

            var formatter = new StringAsHtmlFormatter(CultureInfo.CurrentUICulture);

            // act
            var displayText = violation.FormatDisplayTextWith(formatter);

            // assert
            Assert.That(displayText, Is.EqualTo("SampleViolation: Display text is composed of <strong>AwesomeMethod</strong>"));
        }
        public void ShouldUseCustomFormatter()
        {
            // arrange
            var input = "Int = {A}, StringAsHtml = {B}";

            var formatter = new StringAsHtmlFormatter(CultureInfo.CurrentUICulture);

            // act
            var result = input.Interpolate(new { A = 2, B = "test" }, formatter);

            // assert
            Assert.That(result, Is.EqualTo("Int = 2, StringAsHtml = <strong>test</strong>"));
        }