factor out some test code into the SetUp()

bulletsim
Justin Clark-Casey (justincc) 2011-04-13 18:11:04 +01:00
parent 6613daa82a
commit 08fd1d9bbd
1 changed files with 15 additions and 14 deletions

View File

@ -54,6 +54,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
{ {
protected TestScene m_scene; protected TestScene m_scene;
protected BasicInventoryAccessModule m_iam; protected BasicInventoryAccessModule m_iam;
protected UUID m_userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
protected TestClient m_tc;
[SetUp] [SetUp]
public void SetUp() public void SetUp()
@ -66,20 +68,23 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
m_scene = SceneSetupHelpers.SetupScene("Inventory"); m_scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam); SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam);
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);
AgentCircuitData acd = new AgentCircuitData();
acd.AgentID = m_userId;
m_tc = new TestClient(acd, m_scene);
} }
[Test] [Test]
public void TestRezObject() public void TestRezObject()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
// Create asset // Create asset
SceneObjectGroup object1; SceneObjectGroup object1;
@ -112,17 +117,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
item1.AssetID = asset1.FullID; item1.AssetID = asset1.FullID;
item1.ID = item1Id; item1.ID = item1Id;
InventoryFolderBase objsFolder InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, userId, "Objects")[0]; = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
item1.Folder = objsFolder.ID; item1.Folder = objsFolder.ID;
m_scene.AddInventoryItem(item1); m_scene.AddInventoryItem(item1);
AgentCircuitData acd = new AgentCircuitData();
acd.AgentID = userId;
TestClient tc = new TestClient(acd, m_scene);
SceneObjectGroup so SceneObjectGroup so
= m_iam.RezObject( = m_iam.RezObject(
tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
Assert.That(so, Is.Not.Null); Assert.That(so, Is.Not.Null);