Ejemplo n.º 1
0
 public static string ToHtml <T>(this UniversalGrid <T> grid, string tableClass = null)
 {
     using (var output = new StringWriter())
     {
         grid.ToHtml(output, tableClass);
         return(output.ToString());
     }
 }
Ejemplo n.º 2
0
        public void ToHtml_ReturnsValidXhtmlTable()
        {
            var grid = new UniversalGrid <string>(10, 10);

            grid.SetObject("X", 5, 5);

            var html = grid.ToHtml(tableClass: "tbl");

            var htmlDoc = XDocument.Parse(html);

            Assert.That(htmlDoc.Root.Name.LocalName, Is.EqualTo("table"));
            Assert.That(htmlDoc.Root.Attribute("class").Value, Is.EqualTo("tbl"));
            Assert.That(htmlDoc.Root.Elements().ElementAt(5).Elements().ElementAt(5).Value, Is.EqualTo("X"));

            Console.WriteLine(htmlDoc);
        }
Ejemplo n.º 3
0
        public void ToHtml_SetsColour()
        {
            var grid = new UniversalGrid <string>(10, 10);

            var obj = grid.SetObject("X", 5, 5);

            obj.Colour = new Drawing.Colour()
            {
                R = 255,
                A = 255
            };

            var html = grid.ToHtml();

            var htmlDoc = XDocument.Parse(html);

            Assert.That(htmlDoc.Root.Elements().ElementAt(5).Elements().ElementAt(5).Attribute("style").Value, Is.EqualTo("color: #ff0000"));

            Console.WriteLine(htmlDoc);
        }