本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}