Пример #1
0
        public void AsULTest()
        {
            ErrorDictionary target = new ErrorDictionary();
            string          actual;

            actual = target.AsUL();
            Assert.AreEqual(string.Empty, actual);

            ErrorCollection field1 = new ErrorCollection();

            field1.Add("Test 1");
            target.Add("field1", field1);
            actual = target.AsUL();
            Assert.AreEqual("<ul class=\"errorlist\"><li><ul class=\"errorlist\"><li><label for=\"id_field1\">Test 1</label></li></ul></li></ul>", actual);

            ErrorCollection field2 = new ErrorCollection();

            field2.Add("Test 2");
            target.Add("field2", field2);
            actual = target.AsUL();
            Assert.AreEqual("<ul class=\"errorlist\"><li><ul class=\"errorlist\"><li><label for=\"id_field1\">Test 1</label></li></ul></li><li><ul class=\"errorlist\"><li><label for=\"id_field2\">Test 2</label></li></ul></li></ul>", actual);

            target["field1"].Add("Test 3");
            actual = target.AsUL();
            Assert.AreEqual("<ul class=\"errorlist\"><li><ul class=\"errorlist\"><li><label for=\"id_field1\">Test 1</label></li><li><label for=\"id_field1\">Test 3</label></li></ul></li><li><ul class=\"errorlist\"><li><label for=\"id_field2\">Test 2</label></li></ul></li></ul>", actual);
        }
Пример #2
0
        public void ToStringTest()
        {
            // ToString is a wrapper around AsUL assume AsUL test covers this.
            ErrorDictionary target = new ErrorDictionary();

            Assert.AreEqual(target.AsUL(), target.ToString());
        }
Пример #3
0
        public void AsULTest1()
        {
            ErrorDictionary target = new ErrorDictionary();
            string          actual;
            string          errorClass = "errors";

            ErrorCollection field1 = new ErrorCollection();

            field1.Add("Test 1");
            target.Add("field1", field1);
            actual = target.AsUL(errorClass);
            Assert.AreEqual("<ul class=\"errors\"><li><ul class=\"errors\"><li><label for=\"id_field1\">Test 1</label></li></ul></li></ul>", actual);
        }