コード例 #1
0
        // Test Strings
        public void FormatAsBold_WhenCalled_ShouldEncloseTheStringWithStrongElement()
        {
            var formatter = new HTMLFormatter();
            var result    = formatter.FormatAsBold("abc");

            // Too Specific
            Assert.Equal("<strong>abc</strong>", result.ToLower());
            //More general
            Assert.StartsWith("<strong>", result.ToLower());
            Assert.EndsWith("</strong>", result.ToLower());
            Assert.Contains("abc", result.ToLower());
        }
コード例 #2
0
        public void FormatAsBold_WhenCalled_ShouldReturnStringWithStrongElement()
        {
            var htmlFormat = new HTMLFormatter();

            var result = htmlFormat.FormatAsBold("abc");

            //Specific assertion
            Assert.That(result, Is.EqualTo("<strong>abc</strong>"));

            //More general assertion
            Assert.That(result, Does.StartWith("<strong>"));

            //Better
            Assert.That(result, Does.Contain("abc"));
        }