From 9349cf314963a2b74727b86e37b41642c7212d6d Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 12 Sep 2008 18:13:43 +0000 Subject: move the actual [Test] methods for databases to OpenSim.Data.Tests classes. This did mean loosing 1 unit test that was actually testing an sqlite function directly instead of the interface. --- OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs | 95 +-------------------------- 1 file changed, 3 insertions(+), 92 deletions(-) (limited to 'OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs') diff --git a/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs b/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs index 2e93fd6..94b5bf1 100644 --- a/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs +++ b/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; using OpenSim.Framework; +using OpenSim.Data.Tests; using OpenSim.Data.SQLite; using OpenSim.Region.Environment.Scenes; using OpenMetaverse; @@ -37,16 +38,15 @@ using OpenMetaverse; namespace OpenSim.Data.SQLite.Tests { [TestFixture] - public class SQLiteRegionTest + public class SQLiteRegionTest : BasicRegionTest { public string file = "regiontest.db"; public string connect; - public SQLiteRegionData db; - public UUID region = UUID.Zero; [TestFixtureSetUp] public void Init() { + SuperInit(); connect = "URI=file:" + file + ",version=3"; db = new SQLiteRegionData(); db.Initialise(connect); @@ -57,94 +57,5 @@ namespace OpenSim.Data.SQLite.Tests { System.IO.File.Delete(file); } - - [Test] - public void T001_LoadEmpty() - { - List objs = db.LoadObjects(region); - Assert.AreEqual(0, objs.Count); - } - - // SOG round trips - // * store objects, make sure they save - // * update - - [Test] - public void T010_StoreSimpleObject() - { - SceneObjectGroup sog = NewSOG("object1"); - SceneObjectGroup sog2 = NewSOG("object2"); - - db.StoreObject(sog, region); - db.StoreObject(sog2, region); - - // This tests the ADO.NET driver - List objs = db.LoadObjects(region); - Assert.AreEqual(2, objs.Count); - - // This confirms things actually went to disk - db = new SQLiteRegionData(); - db.Initialise(connect); - - List objs2 = db.LoadObjects(region); - Assert.AreEqual(2, objs2.Count); - } - - [Test] - public void T011_ObjectNames() - { - List objs = db.LoadObjects(region); - foreach (SceneObjectGroup sog in objs) - { - SceneObjectPart p = sog.RootPart; - Assert.That("", Text.DoesNotMatch(p.Name)); - Assert.That(p.Name, Text.Matches(p.Description)); - } - } - - [Test] - public void T012_UpdateObject() - { - string text = "object1 text"; - SceneObjectGroup sog = FindSOG("object1", region); - sog.RootPart.Text = text; - db.StoreObject(sog, region); - - sog = FindSOG("object1", region); - Assert.That(text, Text.Matches(sog.RootPart.Text)); - } - - // Extra private methods - - private SceneObjectGroup FindSOG(string name, UUID r) - { - List objs = db.LoadObjects(r); - foreach (SceneObjectGroup sog in objs) - { - SceneObjectPart p = sog.RootPart; - if (p.Name == name) { - return sog; - } - } - return null; - } - - private SceneObjectGroup NewSOG(string name) - { - SceneObjectGroup sog = new SceneObjectGroup(); - SceneObjectPart sop = new SceneObjectPart(); - sop.LocalId = 1; - sop.Name = name; - sop.Description = name; - sop.Text = ""; - sop.SitName = ""; - sop.TouchName = ""; - sop.UUID = UUID.Random(); - sop.Shape = PrimitiveBaseShape.Default; - sog.AddPart(sop); - sog.RootPart = sop; - return sog; - } - } } \ No newline at end of file -- cgit v1.1