diff options
Diffstat (limited to 'OpenSim/Data/SQLite/Tests')
-rw-r--r-- | OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs b/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs index 725573e..af3bfae 100644 --- a/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs +++ b/OpenSim/Data/SQLite/Tests/SQLiteRegionTest.cs | |||
@@ -26,8 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using OpenSim.Framework; | ||
30 | using OpenSim.Data.SQLite; | 32 | using OpenSim.Data.SQLite; |
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenMetaverse; | ||
31 | 35 | ||
32 | namespace OpenSim.Data.SQLite.Tests | 36 | namespace OpenSim.Data.SQLite.Tests |
33 | { | 37 | { |
@@ -37,13 +41,60 @@ namespace OpenSim.Data.SQLite.Tests | |||
37 | public string file = "regiontest.db"; | 41 | public string file = "regiontest.db"; |
38 | public string connect; | 42 | public string connect; |
39 | public SQLiteRegionData db; | 43 | public SQLiteRegionData db; |
44 | public UUID region = UUID.Zero; | ||
40 | 45 | ||
41 | [SetUp] | 46 | [TestFixtureSetUp] |
42 | public void Init() | 47 | public void Init() |
43 | { | 48 | { |
49 | log4net.Config.XmlConfigurator.Configure(); | ||
50 | System.Console.WriteLine("Entering Init"); | ||
44 | connect = "URI=file:" + file + ",version=3"; | 51 | connect = "URI=file:" + file + ",version=3"; |
45 | db = new SQLiteRegionData(); | 52 | db = new SQLiteRegionData(); |
46 | db.Initialise(connect); | 53 | db.Initialise(connect); |
47 | } | 54 | } |
55 | |||
56 | [TestFixtureTearDown] | ||
57 | public void Cleanup() | ||
58 | { | ||
59 | System.IO.File.Delete(file); | ||
60 | } | ||
61 | |||
62 | [Test] | ||
63 | public void T001_LoadEmpty() | ||
64 | { | ||
65 | System.Console.WriteLine("Entering T001"); | ||
66 | List<SceneObjectGroup> objs = db.LoadObjects(region); | ||
67 | Assert.AreEqual(0, objs.Count); | ||
68 | } | ||
69 | |||
70 | [Test] | ||
71 | public void T010_StoreObject() | ||
72 | { | ||
73 | System.Console.WriteLine("Entering T010"); | ||
74 | SceneObjectGroup sog = NewSOG(); | ||
75 | |||
76 | db.StoreObject(sog, region); | ||
77 | |||
78 | List<SceneObjectGroup> objs = db.LoadObjects(region); | ||
79 | Assert.AreEqual(1, objs.Count); | ||
80 | } | ||
81 | |||
82 | private SceneObjectGroup NewSOG() | ||
83 | { | ||
84 | SceneObjectGroup sog = new SceneObjectGroup(); | ||
85 | SceneObjectPart sop = new SceneObjectPart(); | ||
86 | sop.LocalId = 1; | ||
87 | sop.Name = ""; | ||
88 | sop.Description = ""; | ||
89 | sop.Text = ""; | ||
90 | sop.SitName = ""; | ||
91 | sop.TouchName = ""; | ||
92 | sop.UUID = UUID.Random(); | ||
93 | sop.Shape = PrimitiveBaseShape.Default; | ||
94 | sog.AddPart(sop); | ||
95 | sog.RootPart = sop; | ||
96 | return sog; | ||
97 | } | ||
98 | |||
48 | } | 99 | } |
49 | } \ No newline at end of file | 100 | } \ No newline at end of file |