21 using NUnit.Framework;
26 protected const string AdminUserName =
"SA";
27 protected const string AdminPassword =
"1234567890";
28 protected const string DatabaseName =
"testdb";
30 protected virtual bool SingleContext {
47 return builder.BuildSystem();
51 return system.
CreateDatabase(configuration, AdminUserName, AdminPassword);
55 var user = database.Authenticate(AdminUserName, AdminPassword);
56 var transaction = database.CreateTransaction(
IsolationLevel.Serializable);
57 return new Session(transaction, user);
65 return Database.CreateUserSession(userName, password);
68 protected virtual void OnSetUp(
string testName) {
81 var testName = TestContext.CurrentContext.Test.Name;
95 dbConfig.SetValue(
"database.name", DatabaseName);
126 [TestFixtureTearDown]
TestSystemBuilder(ContextBasedTest test)
void TestFixtureTearDown()
virtual IQuery CreateQuery(ISession session)
virtual ISystem CreateSystem()
virtual void OnTearDown()
virtual ISession CreateAdminSession(IDatabase database)
The default implementation of a database in a system.
IDatabase CreateDatabase(IConfiguration configuration, string adminUser, string adminPassword)
override void OnServiceRegistration(ServiceContainer container)
The representation of a single database in the system.
virtual IDatabase CreateDatabase(ISystem system, IConfiguration configuration)
This is a session that is constructed around a given user and a transaction, to the given database...
ISession CreateUserSession(string userName, string password)
An isolated session to a given database for a given user, encapsulating the transaction for operation...
virtual void OnSetUp(string testName)
Defines the contract for the configuration node of a component within the system or of the system its...
virtual void RegisterServices(ServiceContainer container)
Configuration(bool isRoot)
Constructs the Configuration.