Ejemplo n.º 1
0
        public void Databind_WhenBoundToObjectAndDataboundToProperty_ThenNodesHaveTheText()
        {
            var doc = new XmlDocument();
            doc.LoadXml("<r><template id='a'><span>#{this.data()}</span></template></r>");

            object boundObject = new
                                 {
                                     data = "One"
                                 };

            var result =
                new xContext().Do(new LoadLibrary(doc))
                              .Do(new CreateTag("template"))
                              .Do(new Databind(boundObject));

            Assert.AreEqual(1, result.xTag.Children.Count);
            Assert.AreEqual("One", result.xTag.Children[0].Children[0].Text);
        }
Ejemplo n.º 2
0
 public void RemoveEmptyEntriesTest_WithCharArraySeparator()
 {
     var list = "1111,,2222,3333,,4444,";
     var separators = new[] { ',' };
     var expected = "1111,2222,3333,4444";
     var actual = Strings.RemoveEmptyEntries(list, separators);
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 3
0
        public void Datasource_WhenBoundToArrayOfObjectsAndADatasourceIsIncluded_ThenNodeHaveTheText()
        {
            var doc = new XmlDocument();
            doc.LoadXml("<r><template id='a'><span>Not bound</span><span datasource='BoundSource'><span>#{this.data()}</span></span></template></r>");

            object boundObject = new
                                 {
                                     BoundSource = new
                                                   {
                                                       data = "One"
                                                   }
                                 };

            var result =
                new xContext().Do(new LoadLibrary(doc))
                              .Do(new CreateTag("template"))
                              .Do(new Databind(boundObject));

            Assert.AreEqual(2, result.xTag.Children.Count);
            Assert.AreEqual(1, result.xTag.Children[1].Children.Count);
            Assert.AreEqual(1, result.xTag.Children[1].Children[0].Children.Count);
            Assert.AreEqual("One", result.xTag.Children[1].Children[0].Children[0].Text);
        }