当前位置: 首页>>代码示例>>C#>>正文


C# TestData.Create方法代码示例

本文整理汇总了C#中TestData.Create方法的典型用法代码示例。如果您正苦于以下问题:C# TestData.Create方法的具体用法?C# TestData.Create怎么用?C# TestData.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestData的用法示例。


在下文中一共展示了TestData.Create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PocoRetreival

		public void PocoRetreival()
		{
			var testData = new TestData(sessions);
			testData.Create();

			ISession session = OpenSession();
			ITransaction txn = session.BeginTransaction();

			var stock = session.Get<Stock>(1);
			Assert.That(stock.Id, Is.EqualTo(1L));

			txn.Commit();
			session.Close();

			testData.Destroy();
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:16,代码来源:MultiRepresentationFixture.cs

示例2: XmlHQL

		public void XmlHQL()
		{
			var testData = new TestData(sessions);
			testData.Create();

			ISession session = OpenSession();
			ITransaction txn = session.BeginTransaction();
			ISession xml = session.GetSession(EntityMode.Xml);

			IList result = xml.CreateQuery("from Stock").List();

			Assert.That(result.Count, Is.EqualTo(1L));
			var element = (XmlElement) result[0];
			Assert.That(element.Attributes["id"], Is.EqualTo(testData.stockId));

			Console.WriteLine("**** XML: ****************************************************");
			//prettyPrint( element );
			Console.WriteLine("**************************************************************");

			txn.Rollback();
			session.Close();

			testData.Destroy();
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:24,代码来源:MultiRepresentationFixture.cs

示例3: XmlSave

		public void XmlSave()
		{
			var testData = new TestData(sessions);
			testData.Create();

			ISession pojos = OpenSession();
			ITransaction txn = pojos.BeginTransaction();
			ISession xml = pojos.GetSession(EntityMode.Xml);

			var domDoc = new XmlDocument();
			XmlElement stock = domDoc.CreateElement("stock");
			domDoc.AppendChild(stock);
			XmlElement tradeSymbol = domDoc.CreateElement("tradeSymbol");
			tradeSymbol.InnerText = "Microsoft";
			stock.AppendChild(tradeSymbol);

			XmlElement cval = domDoc.CreateElement("currentValuation");
			XmlElement val = domDoc.CreateElement("valuation");
			stock.AppendChild(cval);
			//val.appendContent(stock); TODO
			XmlElement valuationDate = domDoc.CreateElement("valuationDate");
			tradeSymbol.InnerText = DateTime.Now.ToString();
			val.AppendChild(valuationDate);

			XmlElement value = domDoc.CreateElement("value");
			tradeSymbol.InnerText = "121.00";
			val.AppendChild(value);

			xml.Save(typeof (Stock).FullName, stock);
			xml.Flush();

			txn.Rollback();
			pojos.Close();

			Assert.That(!pojos.IsOpen);
			Assert.That(!xml.IsOpen);

			//prettyPrint( stock );

			testData.Destroy();
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:41,代码来源:MultiRepresentationFixture.cs

示例4: XmlRetreival

		public void XmlRetreival()
		{
			var testData = new TestData(sessions);
			testData.Create();

			ISession session = OpenSession();
			ITransaction txn = session.BeginTransaction();
			ISession xml = session.GetSession(EntityMode.Xml);

			object rtn = xml.Get(typeof (Stock).FullName, testData.stockId);
			var element = (XmlElement) rtn;

			Assert.That(element.Attributes["id"], Is.EqualTo(testData.stockId));

			Console.WriteLine("**** XML: ****************************************************");
			//prettyPrint( element );
			Console.WriteLine("**************************************************************");

			XmlNode currVal = element.GetElementsByTagName("currentValuation")[0];

			Console.WriteLine("**** XML: ****************************************************");
			//prettyPrint( currVal );
			Console.WriteLine("**************************************************************");

			txn.Rollback();
			session.Close();

			testData.Destroy();
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:29,代码来源:MultiRepresentationFixture.cs


注:本文中的TestData.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。