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); }
public void ToStringTest() { // ToString is a wrapper around AsUL assume AsUL test covers this. ErrorDictionary target = new ErrorDictionary(); Assert.AreEqual(target.AsUL(), target.ToString()); }
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); }