Information Technology Reference
In-Depth Information
tests have a specific cost to them: Dependencies have to be put in place
and configured. These tests alone may only take a few seconds; how-
ever, in the aggregate, this time adds up. Some projects with light-
weight component tests can get away with running them with every
commit build.
For example, the component test shown in Listing 6-11 takes, on
average, four seconds to run.
LISTING 6-11
Sample Component Test
using System;
using System.Collections;
using NUnit.Framework;
using NHibernate.Cfg;
using NDbUnit.Core.OleDb;
using NDbUnit.Core;
namespace NHibernate.words
{
[TestFixture]
public class WordTest
{
private const string CONN = @"Provider=SQLOLEDB..";
private const string SCHEMA = @"Dataset2.xsd";
private const string XML = @"XMLFile2.xml";
private OleDbUnitTest fixture;
private ISessionFactory sessFact;
[SetUp]
public void SetUp()
{
this.fixture = new OleDbUnitTest(CONN);
this.fixture.ReadXmlSchema(SCHEMA);
this.fixture.ReadXml(XML);
this.sessFact =
new Configuration().Configure().BuildSessionFactory();
}
[Test]
public void verifyFinder()
{
this.fixture.PerformDbOperation(DbOperationFlag.CleanInsert);
ISession session = this.sessFact.OpenSession();
IQuery qry = session.GetNamedQuery("word.finder.bySpelling");
qry.SetAnsiString("spelling", "pugnacious");
IList list = qry.List();
Search WWH ::




Custom Search