Example #1
0
        public void DataTableMapper_Map_WhenValidDataTable_ExpectValidPaths()
        {
            //------------Setup for test--------------------------
            var dataTableMapper = new DataTableMapper();
            DataTable obj = new DataTable("Foo");
            obj.Columns.Add("Col1");
            obj.Columns.Add("Col2");

            obj.Rows.Add("a", "b");
            obj.Rows.Add("c", "d");
            obj.Rows.Add("e", "f");

            //------------Execute Test---------------------------
            var result = dataTableMapper.Map(obj).ToList();

            //------------Assert Results-------------------------
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual("Foo().Col1", result[0].ActualPath);
            Assert.AreEqual("Foo().Col1", result[0].DisplayPath);
            Assert.AreEqual("a__COMMA__c__COMMA__e", result[0].SampleData);

            Assert.AreEqual("Foo().Col2", result[1].ActualPath);
            Assert.AreEqual("Foo().Col2", result[1].DisplayPath);
            Assert.AreEqual("b__COMMA__d__COMMA__f", result[1].SampleData);
        }
Example #2
0
        public void DataTableMapper_Map_WhenValidDataTableWithHTMLData_ExpectValidPaths()
        {
            //------------Setup for test--------------------------


            const string htmlFragment = @"<html xmlns=""http://www.w3.org/1999/xhtml"">
<head><title>
            All Build Definitions - Microsoft Team Foundation Server
</title>
</head>
</html>";
            var dataTableMapper = new DataTableMapper();
            DataTable obj = new DataTable("Foo");
            obj.Columns.Add("Col1");
            obj.Columns.Add("Col2");

            obj.Rows.Add("a", "b");
            obj.Rows.Add("c", htmlFragment);

            //------------Execute Test---------------------------
            var result = dataTableMapper.Map(obj).ToList();

            //------------Assert Results-------------------------
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual("Foo().Col1", result[0].ActualPath);
            Assert.AreEqual("Foo().Col1", result[0].DisplayPath);
            Assert.AreEqual("a__COMMA__c", result[0].SampleData);

            Assert.AreEqual("Foo().Col2", result[1].ActualPath);
            Assert.AreEqual("Foo().Col2", result[1].DisplayPath);
            Assert.AreEqual("b__COMMA__" + htmlFragment, result[1].SampleData);
        }
Example #3
0
        public void DataTableMapper_Map_WhenNull_ExpectNull()
        {
            //------------Setup for test--------------------------
            var dataTableMapper = new DataTableMapper();
            //------------Execute Test---------------------------
            dataTableMapper.Map(null);

        }