From 4245cd90de4eb11cf6efc8c812c5862b0c8409c0 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 11 Nov 2008 18:21:43 +0000 Subject: minor: refactor some SceneTests code for future tests --- .../Region/Environment/Scenes/Tests/SceneTests.cs | 31 +++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs') diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs index 93b13f7..35b633e 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTests.cs @@ -56,11 +56,10 @@ namespace OpenSim.Region.Environment.Scenes.Tests } /// - /// Test adding an object to a scene. + /// Set up a test scene /// - [Test] - public void TestAddSceneObject() - { + private Scene SetupScene() + { RegionInfo regInfo = new RegionInfo(1000, 1000, null, null); regInfo.RegionName = "Unit test region"; AgentCircuitManager acm = new AgentCircuitManager(); @@ -71,9 +70,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", ""); IConfigSource configSource = new IniConfigSource(); - Scene scene - = new Scene(regInfo, acm, cm, scs, null, sm, null, null, false, false, false, configSource, null); - + return new Scene(regInfo, acm, cm, scs, null, sm, null, null, false, false, false, configSource, null); + } + + /// + /// Add a test object + /// + /// + /// + private SceneObjectPart AddSceneObject(Scene scene) + { SceneObjectGroup sceneObject = new SceneObjectGroup(); SceneObjectPart part = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); @@ -83,6 +89,17 @@ namespace OpenSim.Region.Environment.Scenes.Tests scene.AddNewSceneObject(sceneObject, false); + return part; + } + + /// + /// Test adding an object to a scene. + /// + [Test] + public void TestAddSceneObject() + { + Scene scene = SetupScene(); + SceneObjectPart part = AddSceneObject(scene); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); //System.Console.WriteLine("retrievedPart : {0}", retrievedPart); -- cgit v1.1