|
using System.Xml;
using NDbUnit.Core;
using NDbUnitXPath.Schemas;
using NUnit.Framework;
namespace NDbUnitQuery
{
[TestFixture]
public class DetailedTesting : TestBase
{
XmlDocument xmlDocument;
[TestFixtureSetUp]
public void SetUpFixture()
{
SetUpDatabase(
ConnectionString,
Util.AssemblyResourceStream("Schemas.DBSchema.xsd"),
Util.AssemblyResourceStream("TestData.Initial.xml"),
DbOperationFlag.CleanInsertIdentity
);
}
[Test]
public void AroundTheHornOrderedCPUs()
{
xmlDocument = ResultInspector.LoadTablesAsXML<DBSchema>(
ConnectionString,
false,
"Customers",
"Orders",
"OrderDetails"
);
Assert.IsTrue(
0 < xmlDocument.SelectNodes(
"//Orders[" +
" CustomerID=//Customers[CompanyName='Around the Horn']/CustomerID" +
" and OrderID=//OrderDetails[SKU='CPU-64X2']/OrderID" +
"]").Count
);
}
[Test]
public void MichelaHasCreatedExactlyOneOrder()
{
xmlDocument = ResultInspector.LoadTablesAsXML<DBSchema>(
ConnectionString,
false,
"Orders",
"Employees"
);
Assert.AreEqual(1, xmlDocument.SelectNodes("//Orders[EmployeeID=//Employees[LastName='Michela']/EmployeeID]").Count);
}
[Test]
public void AroundTheHornHasBigOrders()
{
xmlDocument = ResultInspector.LoadTablesAsXML<DBSchema>(
ConnectionString,
true,
"Customers",
"Orders",
"OrderDetails"
);
Assert.IsTrue(0 < xmlDocument.SelectNodes("//Customers[CompanyName='Around the Horn']/Orders/OrderDetails[Quantity>=100]").Count);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Serioja is a senior software developer at HintTech and he implements .NET applications on a consultancy basis for different clients.