Beispiel #1
0
        public void ViewState()
        {
            // XXX weird... something odd going on with
            // ViewState?  or are none of these stored?
            DSPoker p = new DSPoker();

            p.Data      = data;
            p.Transform = "transform";
            p.XPath     = "xpath";

            object  state = p.SaveState();
            DSPoker copy  = new DSPoker();

            copy.LoadState(state);
            Assert.AreEqual("", copy.Data, "A1");
            Assert.AreEqual("", copy.Transform, "A2");
            Assert.AreEqual("", copy.XPath, "A3");

            p               = new DSPoker();
            p.DataFile      = "DataFile";
            p.TransformFile = "TransformFile";

            state = p.SaveState();
            copy  = new DSPoker();

            copy.LoadState(state);
            Assert.AreEqual("", copy.DataFile, "A1");
            Assert.AreEqual("", copy.TransformFile, "A2");
        }
Beispiel #2
0
        public void GetXmlDocument()
        {
            DSPoker p = new DSPoker();

            p.Data = data;
            XmlDocument doc = p.GetXmlDocument();

            HtmlDiff.AssertAreEqual(data, doc.InnerXml, "GetXmlDocument");
        }
Beispiel #3
0
        public void Events()
        {
            DSPoker p = new DSPoker();

            p.Transforming += new EventHandler(p_Transforming);
            Assert.AreEqual(false, checker, "BeforeTransformingEvent");
            p.DoOnTransforming(new EventArgs());
            Assert.AreEqual(true, checker, "AfterTransformingEvent");
        }
Beispiel #4
0
        public void Defaults_NotWorking()
        {
            DSPoker p = new DSPoker();

            Assert.AreEqual(0, p.CacheDuration, "A12");
            Assert.AreEqual(DataSourceCacheExpiry.Absolute, p.CacheExpirationPolicy, "A13");
            Assert.AreEqual("", p.CacheKeyDependency, "A14");
            Assert.AreEqual(true, p.EnableCaching, "A15");
        }
Beispiel #5
0
        public void Attributes()
        {
            DSPoker p = new DSPoker();

            p.Data = data;
            Assert.AreEqual(data, p.Data, "A1");

            p.Transform = "transform";
            Assert.AreEqual("transform", p.Transform, "A2");

            p.XPath = "xpath";
            Assert.AreEqual("xpath", p.XPath, "A3");
        }
Beispiel #6
0
        public void Defaults()
        {
            DSPoker p = new DSPoker();

            Assert.AreEqual("", p.Data, "A4");
            Assert.AreEqual("", p.DataFile, "A5");
            Assert.AreEqual("", p.Transform, "A9");
            Assert.AreEqual("", p.TransformFile, "A10");
            Assert.AreEqual("", p.XPath, "A11");

            // Added
            Assert.AreEqual(null, p.TransformArgumentList, "A17");
        }
Beispiel #7
0
        public void XmlDataSource_DataSourceViewChanged()
        {
            DSPoker p = new DSPoker();

            ((IDataSource)p).DataSourceChanged += new EventHandler(XmlDataSourceTest_DataSourceChanged);
            p.DoOnDataSourceChanged();
            eventAssert.IsTrue("XmlDataSource");              // Assert include counter the first is zero

            p.Data = data;
            eventAssert.IsTrue("XmlDataSource");
            p.Transform = "transform";
            eventAssert.IsTrue("XmlDataSource");
            p.XPath = "xpath";
            eventAssert.IsTrue("XmlDataSource");
            p.DataFile = "DataFile";
            eventAssert.IsTrue("XmlDataSource");
            p.TransformFile = "TransformFile";
            eventAssert.IsTrue("XmlDataSource");
        }
Beispiel #8
0
        public void GetHierarchicalView()
        {
            Page    page = new Page();
            DSPoker ds   = new DSPoker();

            ds.ID   = "ds";
            ds.Data = @"<?xml version=""1.0"" encoding=""utf-8""?>
					<bookstore xmlns:bk=""urn:samples"">
					  <book genre=""novel"" publicationdate=""1999"" bk:ISBN=""0192100262"">
					    <title>Pride and Prejudice</title>
					    <author>
					      <first-name>Jane</first-name>
					      <last-name>Austen</last-name>
					    </author>
					    <price>24.95</price>
					  </book>
					  <book genre=""novel"" publicationdate=""1985"" bk:ISBN=""0771008139"">
					    <title>The Handmaid's Tale</title>
					    <author>
					      <first-name>Margaret</first-name>
					      <last-name>Atwood</last-name>
					    </author>
					    <price>29.95</price>
					  </book>
					</bookstore>"                    ;
            HierarchicalDataSourceView view = ds.DoGetHierarchicalView("");
            IHierarchicalEnumerable    num  = view.Select();

            foreach (object obj in num)
            {
                IHierarchyData hdata   = num.GetHierarchyData(obj);
                XmlElement     element = (XmlElement)hdata.Item;
                Assert.AreEqual("bookstore", element.Name, "RootElementName");
                Assert.AreEqual("Pride and PrejudiceJaneAusten24.95The Handmaid's TaleMargaretAtwood29.95", element.InnerText, "InnerText");
                Assert.AreEqual(2, element.ChildNodes.Count, "ChildElementNodes");
            }
        }
Beispiel #9
0
		public void Attributes ()
		{
			DSPoker p = new DSPoker ();

			p.Data = data;
			Assert.AreEqual (data, p.Data, "A1");

			p.Transform = "transform";
			Assert.AreEqual ("transform", p.Transform, "A2");

			p.XPath = "xpath";
			Assert.AreEqual ("xpath", p.XPath, "A3");
		}
Beispiel #10
0
		public void Defaults ()
		{
			DSPoker p = new DSPoker ();

			Assert.AreEqual ("", p.Data, "A4");
			Assert.AreEqual ("", p.DataFile, "A5");
			Assert.AreEqual ("", p.Transform, "A9");
			Assert.AreEqual ("", p.TransformFile, "A10");
			Assert.AreEqual ("", p.XPath, "A11");
			
			// Added
			Assert.AreEqual (null, p.TransformArgumentList, "A17");
		}
Beispiel #11
0
		public void GetXmlDocumentException ()
		{
			DSPoker p = new DSPoker ();
			p.GetXmlDocument ();
		}
Beispiel #12
0
		public void Events ()
		{
			DSPoker p = new DSPoker ();
			p.Transforming += new EventHandler (p_Transforming);
			Assert.AreEqual (false, checker, "BeforeTransformingEvent");
			p.DoOnTransforming (new EventArgs ());
			Assert.AreEqual (true, checker, "AfterTransformingEvent");
		}
Beispiel #13
0
		public void GetHierarchicalView ()
		{
			Page page = new Page ();
			DSPoker ds = new DSPoker ();
			ds.ID = "ds";
			ds.Data = @"<?xml version=""1.0"" encoding=""utf-8""?>
					<bookstore xmlns:bk=""urn:samples"">
					  <book genre=""novel"" publicationdate=""1999"" bk:ISBN=""0192100262"">
					    <title>Pride and Prejudice</title>
					    <author>
					      <first-name>Jane</first-name>
					      <last-name>Austen</last-name>
					    </author>
					    <price>24.95</price>
					  </book>
					  <book genre=""novel"" publicationdate=""1985"" bk:ISBN=""0771008139"">
					    <title>The Handmaid's Tale</title>
					    <author>
					      <first-name>Margaret</first-name>
					      <last-name>Atwood</last-name>
					    </author>
					    <price>29.95</price>
					  </book>
					</bookstore>";
			HierarchicalDataSourceView view = ds.DoGetHierarchicalView ("");
			IHierarchicalEnumerable num = view.Select ();
			foreach (object obj in num) {
				IHierarchyData hdata = num.GetHierarchyData (obj);
				XmlElement element = (XmlElement) hdata.Item;
				Assert.AreEqual ("bookstore", element.Name, "RootElementName");
				Assert.AreEqual ("Pride and PrejudiceJaneAusten24.95The Handmaid's TaleMargaretAtwood29.95", element.InnerText, "InnerText");
				Assert.AreEqual (2, element.ChildNodes.Count, "ChildElementNodes");
			}
		}
Beispiel #14
0
		public void GetXmlDocument ()
		{
			DSPoker p = new DSPoker ();
			p.Data = data;
			XmlDocument doc = p.GetXmlDocument ();
			HtmlDiff.AssertAreEqual (data, doc.InnerXml, "GetXmlDocument");
		}
Beispiel #15
0
		public void XmlDataSource_DataSourceViewChanged ()
		{
			DSPoker p = new DSPoker ();
			((IDataSource) p).DataSourceChanged += new EventHandler (XmlDataSourceTest_DataSourceChanged);
			p.DoOnDataSourceChanged ();
			eventAssert.IsTrue ("XmlDataSource"); // Assert include counter the first is zero

			p.Data = data;
			eventAssert.IsTrue ("XmlDataSource");
			p.Transform = "transform";
			eventAssert.IsTrue ("XmlDataSource");
			p.XPath = "xpath";
			eventAssert.IsTrue ("XmlDataSource");
			p.DataFile = "DataFile";
			eventAssert.IsTrue ("XmlDataSource");
			p.TransformFile = "TransformFile";
			eventAssert.IsTrue ("XmlDataSource");
		}
Beispiel #16
0
		public void ViewState ()
		{
			// XXX weird... something odd going on with
			// ViewState?  or are none of these stored?
			DSPoker p = new DSPoker ();

			p.Data = data;
			p.Transform = "transform";
			p.XPath = "xpath";

			object state = p.SaveState ();
			DSPoker copy = new DSPoker ();
			copy.LoadState (state);
			Assert.AreEqual ("", copy.Data, "A1");
			Assert.AreEqual ("", copy.Transform, "A2");
			Assert.AreEqual ("", copy.XPath, "A3");

			p = new DSPoker ();
			p.DataFile = "DataFile";
			p.TransformFile = "TransformFile";

			state = p.SaveState ();
			copy = new DSPoker ();

			copy.LoadState (state);
			Assert.AreEqual ("", copy.DataFile, "A1");
			Assert.AreEqual ("", copy.TransformFile, "A2");
		}
Beispiel #17
0
        public void GetXmlDocumentException()
        {
            DSPoker p = new DSPoker();

            p.GetXmlDocument();
        }
Beispiel #18
0
		public void Defaults_NotWorking ()
		{
			DSPoker p = new DSPoker ();
			Assert.AreEqual (0, p.CacheDuration, "A12");
			Assert.AreEqual (DataSourceCacheExpiry.Absolute, p.CacheExpirationPolicy, "A13");
			Assert.AreEqual ("", p.CacheKeyDependency, "A14");
			Assert.AreEqual (true, p.EnableCaching, "A15");
		}