Various minor changes in the data tests

soprefactor
AlexRa 2010-05-23 11:31:19 +03:00
parent 9976cb93ce
commit 89b7c64b6f
5 changed files with 18 additions and 16 deletions

View File

@ -106,10 +106,18 @@ namespace OpenSim.Data.Tests
protected override void InitService(object service)
{
ClearDB();
m_db = (TAssetData)service;
m_db.Initialise(m_connStr);
}
private void ClearDB()
{
DropTables("assets");
ResetMigrations("AssetStore");
}
[Test]
public void T001_LoadEmpty()
{

View File

@ -183,9 +183,10 @@ namespace OpenSim.Data.Tests
lst += ", " + s;
}
string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
try
{
ExecuteSql("DELETE FROM `migrations` where name in (" + lst + ");");
ExecuteSql("DELETE FROM migrations where name " + sCond);
}
catch
{

View File

@ -108,17 +108,7 @@ namespace OpenSim.Data.Tests
private void ClearDB()
{
// if a new table is added, it has to be dropped here
ExecuteSql("delete from migrations where name='EstateStore';");
DropTables(
"prims",
"primshapes",
"primitems",
"terrain",
"land",
"landaccesslist",
"regionban",
"regionsettings",
"estate_managers",
"estate_groups",
"estate_users",
@ -126,6 +116,7 @@ namespace OpenSim.Data.Tests
"estate_settings",
"estate_map"
);
ResetMigrations("EstateStore");
}
#region 0Tests

View File

@ -123,7 +123,7 @@ namespace OpenSim.Data.Tests
private void ClearDB()
{
DropTables("inventoryitems", "inventoryfolders");
ExecuteSql("delete from migrations where name='Inventory'");
ResetMigrations("InventoryStore");
}
[Test]
@ -194,8 +194,10 @@ namespace OpenSim.Data.Tests
[Test]
public void T013_FolderHierarchy()
{
Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))");
int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned)
Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
n = db.getFolderHierarchy(folder1).Count;
Assert.That(n, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))");
Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))");
Assert.That(db.getFolderHierarchy(folder3).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder3).Count, Is.EqualTo(0))");
Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0))");

View File

@ -118,8 +118,8 @@ namespace OpenSim.Data.Tests
m_rebuildDB = rebuild;
}
public RegionTests() : this("", false) { }
public RegionTests(string conn) : this(conn, false) {}
public RegionTests() : this("", true) { }
public RegionTests(string conn) : this(conn, true) {}
public RegionTests(bool rebuild): this("", rebuild) {}