2 more InventoryItem tests, plus see if I can leave the log4net

configure in there to help me get debug messages while developing.
0.6.0-stable
Sean Dague 2008-09-13 02:06:23 +00:00
parent 8ae8bec4d1
commit fcc716104b
2 changed files with 26 additions and 0 deletions

View File

@ -34,6 +34,7 @@ using OpenSim.Data.Tests;
using OpenSim.Data.SQLite; using OpenSim.Data.SQLite;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenMetaverse; using OpenMetaverse;
using log4net;
namespace OpenSim.Data.SQLite.Tests namespace OpenSim.Data.SQLite.Tests
{ {
@ -47,6 +48,7 @@ namespace OpenSim.Data.SQLite.Tests
public void Init() public void Init()
{ {
SuperInit(); SuperInit();
log4net.Config.XmlConfigurator.Configure();
connect = "URI=file:" + file + ",version=3"; connect = "URI=file:" + file + ",version=3";
db = new SQLiteInventoryStore(); db = new SQLiteInventoryStore();
db.Initialise(connect); db.Initialise(connect);

View File

@ -197,6 +197,7 @@ namespace OpenSim.Data.Tests
} }
// Item tests // Item tests
[Test]
public void T100_NoItems() public void T100_NoItems()
{ {
Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0)); Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0));
@ -205,6 +206,10 @@ namespace OpenSim.Data.Tests
Assert.That(db.getInventoryInFolder(folder3).Count, Is.EqualTo(0)); Assert.That(db.getInventoryInFolder(folder3).Count, Is.EqualTo(0));
} }
// TODO: Feeding a bad inventory item down the data path will
// crash the system. This is largely due to the builder
// routines. That should be fixed and tested for.
[Test]
public void T101_CreatItems() public void T101_CreatItems()
{ {
db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1));
@ -212,6 +217,23 @@ namespace OpenSim.Data.Tests
db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3));
Assert.That(db.getInventoryInFolder(folder3).Count, Is.EqualTo(3)); Assert.That(db.getInventoryInFolder(folder3).Count, Is.EqualTo(3));
} }
[Test]
public void T102_CompareItems()
{
InventoryItemBase i1 = db.getInventoryItem(item1);
InventoryItemBase i2 = db.getInventoryItem(item2);
InventoryItemBase i3 = db.getInventoryItem(item3);
Assert.That(i1.Name, Is.EqualTo(iname1));
Assert.That(i2.Name, Is.EqualTo(iname2));
Assert.That(i3.Name, Is.EqualTo(iname3));
Assert.That(i1.Owner, Is.EqualTo(owner1));
Assert.That(i2.Owner, Is.EqualTo(owner1));
Assert.That(i3.Owner, Is.EqualTo(owner1));
Assert.That(i1.AssetID, Is.EqualTo(asset1));
Assert.That(i2.AssetID, Is.EqualTo(asset2));
Assert.That(i3.AssetID, Is.EqualTo(asset3));
}
private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset)
@ -220,7 +242,9 @@ namespace OpenSim.Data.Tests
i.ID = id; i.ID = id;
i.Folder = parent; i.Folder = parent;
i.Owner = owner; i.Owner = owner;
i.Creator = owner;
i.Name = name; i.Name = name;
i.Description = name;
i.AssetID = asset; i.AssetID = asset;
return i; return i;
} }