コード例 #1
0
        public void Test_HighlightKeyWords()
        {
            //input params - text, keyword, css style, full match
            string text      = "he method is rather simple. We set up a new BankAccount object with a beginning balance and then withdraw a valid amount. We use the Microsoft unit test framework for managed code AreEqual";
            string keyword   = "BankAcc";
            string css       = "yellow";
            bool   isMatched = true;

            //act
            string actual   = TextRender.HighlightKeyWords(text, keyword, css, isMatched);
            string expected = "he method is rather simple. We set up a new <span style=\"background-color:yellow\">BankAcc</span>ount object with a beginning balance and then withdraw a valid amount. We use the Microsoft unit test framework for managed code AreEqual";

            Assert.AreEqual(expected, actual, true, "HighlightKeyWords value is not equal from expected value.");
        }