diff options
author | Kunnis | 2009-08-09 02:01:21 -0500 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-16 13:35:44 -0400 |
commit | 23d478f2fa06d1dedabfb24cf6ff763b586173ce (patch) | |
tree | 072fdcfe343d84cf01b0881045fc96fb8403c324 /OpenSim/Data/Tests | |
parent | Add copyright header. Formatting cleanup. (diff) | |
download | opensim-SC_OLD-23d478f2fa06d1dedabfb24cf6ff763b586173ce.zip opensim-SC_OLD-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.gz opensim-SC_OLD-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.bz2 opensim-SC_OLD-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.xz |
Adding in Reflection-based testing, to ensure that all properties are covered.
Diffstat (limited to 'OpenSim/Data/Tests')
-rw-r--r-- | OpenSim/Data/Tests/BasicAssetTest.cs | 19 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicEstateTest.cs | 18 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicGridTest.cs | 79 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicInventoryTest.cs | 37 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicRegionTest.cs | 47 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicUserTest.cs | 30 |
6 files changed, 140 insertions, 90 deletions
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index e85a6a7..eddb999 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs | |||
@@ -32,7 +32,6 @@ using NUnit.Framework.SyntaxHelpers; | |||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using log4net; | 34 | using log4net; |
35 | using System.Reflection; | ||
36 | 35 | ||
37 | namespace OpenSim.Data.Tests | 36 | namespace OpenSim.Data.Tests |
38 | { | 37 | { |
@@ -77,25 +76,31 @@ namespace OpenSim.Data.Tests | |||
77 | AssetBase a1 = new AssetBase(uuid1, "asset one"); | 76 | AssetBase a1 = new AssetBase(uuid1, "asset one"); |
78 | AssetBase a2 = new AssetBase(uuid2, "asset two"); | 77 | AssetBase a2 = new AssetBase(uuid2, "asset two"); |
79 | AssetBase a3 = new AssetBase(uuid3, "asset three"); | 78 | AssetBase a3 = new AssetBase(uuid3, "asset three"); |
79 | |||
80 | ScrambleForTesting.Scramble(a1); | ||
81 | ScrambleForTesting.Scramble(a2); | ||
82 | ScrambleForTesting.Scramble(a3); | ||
83 | |||
80 | a1.Data = asset1; | 84 | a1.Data = asset1; |
81 | a2.Data = asset1; | 85 | a2.Data = asset1; |
82 | a3.Data = asset1; | 86 | a3.Data = asset1; |
83 | 87 | ||
88 | a1.FullID = uuid1; | ||
89 | a2.FullID = uuid2; | ||
90 | a3.FullID = uuid3; | ||
91 | |||
84 | db.CreateAsset(a1); | 92 | db.CreateAsset(a1); |
85 | db.CreateAsset(a2); | 93 | db.CreateAsset(a2); |
86 | db.CreateAsset(a3); | 94 | db.CreateAsset(a3); |
87 | 95 | ||
88 | AssetBase a1a = db.FetchAsset(uuid1); | 96 | AssetBase a1a = db.FetchAsset(uuid1); |
89 | Assert.That(a1.ID, Is.EqualTo(a1a.ID), "Assert.That(a1.ID, Is.EqualTo(a1a.ID))"); | 97 | Assert.That(a1, Constraints.PropertyCompareConstraint(a1a)); |
90 | Assert.That(a1.Name, Is.EqualTo(a1a.Name), "Assert.That(a1.Name, Is.EqualTo(a1a.Name))"); | ||
91 | 98 | ||
92 | AssetBase a2a = db.FetchAsset(uuid2); | 99 | AssetBase a2a = db.FetchAsset(uuid2); |
93 | Assert.That(a2.ID, Is.EqualTo(a2a.ID), "Assert.That(a2.ID, Is.EqualTo(a2a.ID))"); | 100 | Assert.That(a2, Constraints.PropertyCompareConstraint(a2a)); |
94 | Assert.That(a2.Name, Is.EqualTo(a2a.Name), "Assert.That(a2.Name, Is.EqualTo(a2a.Name))"); | ||
95 | 101 | ||
96 | AssetBase a3a = db.FetchAsset(uuid3); | 102 | AssetBase a3a = db.FetchAsset(uuid3); |
97 | Assert.That(a3.ID, Is.EqualTo(a3a.ID), "Assert.That(a3.ID, Is.EqualTo(a3a.ID))"); | 103 | Assert.That(a3, Constraints.PropertyCompareConstraint(a3a)); |
98 | Assert.That(a3.Name, Is.EqualTo(a3a.Name), "Assert.That(a3.Name, Is.EqualTo(a3a.Name))"); | ||
99 | } | 104 | } |
100 | 105 | ||
101 | [Test] | 106 | [Test] |
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs index a0266b3..b702e2a 100644 --- a/OpenSim/Data/Tests/BasicEstateTest.cs +++ b/OpenSim/Data/Tests/BasicEstateTest.cs | |||
@@ -163,6 +163,24 @@ namespace OpenSim.Data.Tests | |||
163 | } | 163 | } |
164 | 164 | ||
165 | [Test] | 165 | [Test] |
166 | private void T012_EstateSettingsRandomStorage() | ||
167 | { | ||
168 | |||
169 | // Letting estate store generate rows to database for us | ||
170 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); | ||
171 | ScrambleForTesting.Scramble(originalSettings); | ||
172 | |||
173 | // Saving settings. | ||
174 | db.StoreEstateSettings(originalSettings); | ||
175 | |||
176 | // Loading settings to another instance variable. | ||
177 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); | ||
178 | |||
179 | // Checking that loaded values are correct. | ||
180 | Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings)); | ||
181 | } | ||
182 | |||
183 | [Test] | ||
166 | public void T020_EstateSettingsManagerList() | 184 | public void T020_EstateSettingsManagerList() |
167 | { | 185 | { |
168 | // Letting estate store generate rows to database for us | 186 | // Letting estate store generate rows to database for us |
diff --git a/OpenSim/Data/Tests/BasicGridTest.cs b/OpenSim/Data/Tests/BasicGridTest.cs index 85273c5..b0ee4a0 100644 --- a/OpenSim/Data/Tests/BasicGridTest.cs +++ b/OpenSim/Data/Tests/BasicGridTest.cs | |||
@@ -49,9 +49,13 @@ namespace OpenSim.Data.Tests | |||
49 | public void removeAllRegions() | 49 | public void removeAllRegions() |
50 | { | 50 | { |
51 | // Clean up all the regions. | 51 | // Clean up all the regions. |
52 | foreach (RegionProfileData region in db.GetRegionsByName("", 100)) | 52 | List<RegionProfileData> regions = db.GetRegionsByName("", 100); |
53 | if(regions != null) | ||
53 | { | 54 | { |
54 | db.DeleteProfile(region.Uuid.ToString()); | 55 | foreach (RegionProfileData region in regions) |
56 | { | ||
57 | db.DeleteProfile(region.Uuid.ToString()); | ||
58 | } | ||
55 | } | 59 | } |
56 | } | 60 | } |
57 | 61 | ||
@@ -74,35 +78,9 @@ namespace OpenSim.Data.Tests | |||
74 | protected RegionProfileData createRegion(UUID regionUUID, string regionName) | 78 | protected RegionProfileData createRegion(UUID regionUUID, string regionName) |
75 | { | 79 | { |
76 | RegionProfileData reg = new RegionProfileData(); | 80 | RegionProfileData reg = new RegionProfileData(); |
81 | ScrambleForTesting.Scramble(reg); | ||
77 | reg.Uuid = regionUUID; | 82 | reg.Uuid = regionUUID; |
78 | reg.RegionName = regionName; | 83 | reg.RegionName = regionName; |
79 | reg.RegionHandle = (ulong) random.Next(); | ||
80 | reg.RegionLocX = (uint) random.Next(); | ||
81 | reg.RegionLocY = (uint) random.Next(); | ||
82 | reg.RegionLocZ = (uint) random.Next(); | ||
83 | reg.RegionSendKey = RandomName(); | ||
84 | reg.RegionRecvKey = RandomName(); | ||
85 | reg.RegionSecret = RandomName(); | ||
86 | reg.RegionOnline = false; | ||
87 | reg.ServerIP = RandomName(); | ||
88 | reg.ServerPort = (uint) random.Next(); | ||
89 | reg.ServerURI = RandomName(); | ||
90 | reg.ServerHttpPort = (uint) random.Next(); | ||
91 | reg.ServerRemotingPort = (uint) random.Next(); | ||
92 | reg.NorthOverrideHandle = (ulong) random.Next(); | ||
93 | reg.SouthOverrideHandle = (ulong) random.Next(); | ||
94 | reg.EastOverrideHandle = (ulong) random.Next(); | ||
95 | reg.WestOverrideHandle = (ulong) random.Next(); | ||
96 | reg.RegionDataURI = RandomName(); | ||
97 | reg.RegionAssetURI = RandomName(); | ||
98 | reg.RegionAssetSendKey = RandomName(); | ||
99 | reg.RegionAssetRecvKey = RandomName(); | ||
100 | reg.RegionUserURI = RandomName(); | ||
101 | reg.RegionUserSendKey = RandomName(); | ||
102 | reg.RegionUserRecvKey = RandomName(); | ||
103 | reg.RegionMapTextureID = UUID.Random(); | ||
104 | reg.Owner_uuid = UUID.Random(); | ||
105 | reg.OriginUUID = UUID.Random(); | ||
106 | 84 | ||
107 | db.AddProfile(reg); | 85 | db.AddProfile(reg); |
108 | 86 | ||
@@ -119,47 +97,12 @@ namespace OpenSim.Data.Tests | |||
119 | } | 97 | } |
120 | 98 | ||
121 | [Test] | 99 | [Test] |
122 | public void T999_StillNull() | ||
123 | { | ||
124 | Assert.That(db.GetProfileByUUID(zero),Is.Null); | ||
125 | } | ||
126 | |||
127 | [Test] | ||
128 | public void T011_AddRetrieveCompleteTest() | 100 | public void T011_AddRetrieveCompleteTest() |
129 | { | 101 | { |
130 | RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|"); | 102 | RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|"); |
131 | RegionProfileData retreg = db.GetProfileByUUID(region2); | 103 | RegionProfileData retreg = db.GetProfileByUUID(region2); |
132 | 104 | ||
133 | Assert.That(retreg.RegionName, Is.EqualTo(newreg.RegionName), "Assert.That(retreg.RegionName, Is.EqualTo(newreg.RegionName))"); | 105 | Assert.That(retreg, Constraints.PropertyCompareConstraint(newreg).IgnoreProperty(x => x.RegionOnline)); |
134 | Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))"); | ||
135 | Assert.That(retreg.RegionHandle, Is.EqualTo(newreg.RegionHandle), "Assert.That(retreg.RegionHandle, Is.EqualTo(newreg.RegionHandle))"); | ||
136 | Assert.That(retreg.RegionLocX, Is.EqualTo(newreg.RegionLocX), "Assert.That(retreg.RegionLocX, Is.EqualTo(newreg.RegionLocX))"); | ||
137 | Assert.That(retreg.RegionLocY, Is.EqualTo(newreg.RegionLocY), "Assert.That(retreg.RegionLocY, Is.EqualTo(newreg.RegionLocY))"); | ||
138 | Assert.That(retreg.RegionLocZ, Is.EqualTo(newreg.RegionLocZ), "Assert.That(retreg.RegionLocZ, Is.EqualTo(newreg.RegionLocZ))"); | ||
139 | Assert.That(retreg.RegionSendKey, Is.EqualTo(newreg.RegionSendKey), "Assert.That(retreg.RegionSendKey, Is.EqualTo(newreg.RegionSendKey))"); | ||
140 | Assert.That(retreg.RegionRecvKey, Is.EqualTo(newreg.RegionRecvKey), "Assert.That(retreg.RegionRecvKey, Is.EqualTo(newreg.RegionRecvKey))"); | ||
141 | Assert.That(retreg.RegionSecret, Is.EqualTo(newreg.RegionSecret), "Assert.That(retreg.RegionSecret, Is.EqualTo(newreg.RegionSecret))"); | ||
142 | Assert.That(retreg.RegionOnline, Is.EqualTo(newreg.RegionOnline), "Assert.That(retreg.RegionOnline, Is.EqualTo(newreg.RegionOnline))"); | ||
143 | Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID), "Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID))"); | ||
144 | Assert.That(retreg.ServerIP, Is.EqualTo(newreg.ServerIP), "Assert.That(retreg.ServerIP, Is.EqualTo(newreg.ServerIP))"); | ||
145 | Assert.That(retreg.ServerPort, Is.EqualTo(newreg.ServerPort), "Assert.That(retreg.ServerPort, Is.EqualTo(newreg.ServerPort))"); | ||
146 | Assert.That(retreg.ServerURI, Is.EqualTo(newreg.ServerURI), "Assert.That(retreg.ServerURI, Is.EqualTo(newreg.ServerURI))"); | ||
147 | Assert.That(retreg.ServerHttpPort, Is.EqualTo(newreg.ServerHttpPort), "Assert.That(retreg.ServerHttpPort, Is.EqualTo(newreg.ServerHttpPort))"); | ||
148 | Assert.That(retreg.ServerRemotingPort, Is.EqualTo(newreg.ServerRemotingPort), "Assert.That(retreg.ServerRemotingPort, Is.EqualTo(newreg.ServerRemotingPort))"); | ||
149 | Assert.That(retreg.NorthOverrideHandle, Is.EqualTo(newreg.NorthOverrideHandle), "Assert.That(retreg.NorthOverrideHandle, Is.EqualTo(newreg.NorthOverrideHandle))"); | ||
150 | Assert.That(retreg.SouthOverrideHandle, Is.EqualTo(newreg.SouthOverrideHandle), "Assert.That(retreg.SouthOverrideHandle, Is.EqualTo(newreg.SouthOverrideHandle))"); | ||
151 | Assert.That(retreg.EastOverrideHandle, Is.EqualTo(newreg.EastOverrideHandle), "Assert.That(retreg.EastOverrideHandle, Is.EqualTo(newreg.EastOverrideHandle))"); | ||
152 | Assert.That(retreg.WestOverrideHandle, Is.EqualTo(newreg.WestOverrideHandle), "Assert.That(retreg.WestOverrideHandle, Is.EqualTo(newreg.WestOverrideHandle))"); | ||
153 | Assert.That(retreg.RegionDataURI, Is.EqualTo(newreg.RegionDataURI), "Assert.That(retreg.RegionDataURI, Is.EqualTo(newreg.RegionDataURI))"); | ||
154 | Assert.That(retreg.RegionAssetURI, Is.EqualTo(newreg.RegionAssetURI), "Assert.That(retreg.RegionAssetURI, Is.EqualTo(newreg.RegionAssetURI))"); | ||
155 | Assert.That(retreg.RegionAssetSendKey, Is.EqualTo(newreg.RegionAssetSendKey), "Assert.That(retreg.RegionAssetSendKey, Is.EqualTo(newreg.RegionAssetSendKey))"); | ||
156 | Assert.That(retreg.RegionAssetRecvKey, Is.EqualTo(newreg.RegionAssetRecvKey), "Assert.That(retreg.RegionAssetRecvKey, Is.EqualTo(newreg.RegionAssetRecvKey))"); | ||
157 | Assert.That(retreg.RegionUserURI, Is.EqualTo(newreg.RegionUserURI), "Assert.That(retreg.RegionUserURI, Is.EqualTo(newreg.RegionUserURI))"); | ||
158 | Assert.That(retreg.RegionUserSendKey, Is.EqualTo(newreg.RegionUserSendKey), "Assert.That(retreg.RegionUserSendKey, Is.EqualTo(newreg.RegionUserSendKey))"); | ||
159 | Assert.That(retreg.RegionUserRecvKey, Is.EqualTo(newreg.RegionUserRecvKey), "Assert.That(retreg.RegionUserRecvKey, Is.EqualTo(newreg.RegionUserRecvKey))"); | ||
160 | Assert.That(retreg.RegionMapTextureID, Is.EqualTo(newreg.RegionMapTextureID), "Assert.That(retreg.RegionMapTextureID, Is.EqualTo(newreg.RegionMapTextureID))"); | ||
161 | Assert.That(retreg.Owner_uuid, Is.EqualTo(newreg.Owner_uuid), "Assert.That(retreg.Owner_uuid, Is.EqualTo(newreg.Owner_uuid))"); | ||
162 | Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID), "Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID))"); | ||
163 | 106 | ||
164 | retreg = db.GetProfileByHandle(newreg.RegionHandle); | 107 | retreg = db.GetProfileByHandle(newreg.RegionHandle); |
165 | Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))"); | 108 | Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))"); |
@@ -220,6 +163,12 @@ namespace OpenSim.Data.Tests | |||
220 | Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))"); | 163 | Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))"); |
221 | } | 164 | } |
222 | 165 | ||
166 | [Test] | ||
167 | public void T999_StillNull() | ||
168 | { | ||
169 | Assert.That(db.GetProfileByUUID(zero), Is.Null); | ||
170 | } | ||
171 | |||
223 | protected static string RandomName() | 172 | protected static string RandomName() |
224 | { | 173 | { |
225 | StringBuilder name = new StringBuilder(); | 174 | StringBuilder name = new StringBuilder(); |
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs index e13ed89..3c33bb4 100644 --- a/OpenSim/Data/Tests/BasicInventoryTest.cs +++ b/OpenSim/Data/Tests/BasicInventoryTest.cs | |||
@@ -115,16 +115,6 @@ namespace OpenSim.Data.Tests | |||
115 | Assert.That(db.getUserRootFolder(owner1), Is.Null); | 115 | Assert.That(db.getUserRootFolder(owner1), Is.Null); |
116 | } | 116 | } |
117 | 117 | ||
118 | [Test] | ||
119 | public void T999_StillNull() | ||
120 | { | ||
121 | // After all tests are run, these should still return no results | ||
122 | Assert.That(db.getInventoryFolder(zero), Is.Null); | ||
123 | Assert.That(db.getInventoryItem(zero), Is.Null); | ||
124 | Assert.That(db.getUserRootFolder(zero), Is.Null); | ||
125 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); | ||
126 | } | ||
127 | |||
128 | // 01x - folder tests | 118 | // 01x - folder tests |
129 | [Test] | 119 | [Test] |
130 | public void T010_FolderNonParent() | 120 | public void T010_FolderNonParent() |
@@ -248,7 +238,7 @@ namespace OpenSim.Data.Tests | |||
248 | } | 238 | } |
249 | 239 | ||
250 | [Test] | 240 | [Test] |
251 | public void T103UpdateItem() | 241 | public void T103_UpdateItem() |
252 | { | 242 | { |
253 | // TODO: probably shouldn't have the ability to have an | 243 | // TODO: probably shouldn't have the ability to have an |
254 | // owner of an item in a folder not owned by the user | 244 | // owner of an item in a folder not owned by the user |
@@ -265,6 +255,31 @@ namespace OpenSim.Data.Tests | |||
265 | Assert.That(i1.Owner, Is.EqualTo(owner2), "Assert.That(i1.Owner, Is.EqualTo(owner2))"); | 255 | Assert.That(i1.Owner, Is.EqualTo(owner2), "Assert.That(i1.Owner, Is.EqualTo(owner2))"); |
266 | } | 256 | } |
267 | 257 | ||
258 | [Test] | ||
259 | public void T104_RandomUpdateItem() | ||
260 | { | ||
261 | InventoryItemBase expected = db.getInventoryItem(item1); | ||
262 | ScrambleForTesting.Scramble(expected); | ||
263 | expected.ID = item1; | ||
264 | db.updateInventoryItem(expected); | ||
265 | |||
266 | InventoryItemBase actual = db.getInventoryItem(item1); | ||
267 | Assert.That(actual, Constraints.PropertyCompareConstraint(expected) | ||
268 | .IgnoreProperty(x=>x.InvType) | ||
269 | .IgnoreProperty(x=>x.Description) | ||
270 | .IgnoreProperty(x=>x.CreatorId)); | ||
271 | } | ||
272 | |||
273 | [Test] | ||
274 | public void T999_StillNull() | ||
275 | { | ||
276 | // After all tests are run, these should still return no results | ||
277 | Assert.That(db.getInventoryFolder(zero), Is.Null); | ||
278 | Assert.That(db.getInventoryItem(zero), Is.Null); | ||
279 | Assert.That(db.getUserRootFolder(zero), Is.Null); | ||
280 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); | ||
281 | } | ||
282 | |||
268 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) | 283 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) |
269 | { | 284 | { |
270 | InventoryItemBase i = new InventoryItemBase(); | 285 | InventoryItemBase i = new InventoryItemBase(); |
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 836da78..a746ef0 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs | |||
@@ -532,6 +532,53 @@ namespace OpenSim.Data.Tests | |||
532 | Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration), "Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration))"); | 532 | Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration), "Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration))"); |
533 | } | 533 | } |
534 | } | 534 | } |
535 | |||
536 | [Test] | ||
537 | public void T016_RandomSogWithSceneParts() | ||
538 | { | ||
539 | UUID tmpSog = UUID.Random(); | ||
540 | UUID tmp1 = UUID.Random(); | ||
541 | UUID tmp2 = UUID.Random(); | ||
542 | UUID tmp3 = UUID.Random(); | ||
543 | UUID newregion = UUID.Random(); | ||
544 | SceneObjectPart p1 = new SceneObjectPart(); | ||
545 | SceneObjectPart p2 = new SceneObjectPart(); | ||
546 | SceneObjectPart p3 = new SceneObjectPart(); | ||
547 | p1.Shape = PrimitiveBaseShape.Default; | ||
548 | p2.Shape = PrimitiveBaseShape.Default; | ||
549 | p3.Shape = PrimitiveBaseShape.Default; | ||
550 | ScrambleForTesting.Scramble(p1); | ||
551 | ScrambleForTesting.Scramble(p2); | ||
552 | ScrambleForTesting.Scramble(p3); | ||
553 | p1.UUID = tmp1; | ||
554 | p2.UUID = tmp2; | ||
555 | p3.UUID = tmp3; | ||
556 | SceneObjectGroup sog = NewSOG("Sop 0", tmpSog, newregion); | ||
557 | ScrambleForTesting.Scramble(sog); | ||
558 | sog.UUID = tmpSog; | ||
559 | sog.AddPart(p1); | ||
560 | sog.AddPart(p2); | ||
561 | sog.AddPart(p3); | ||
562 | |||
563 | SceneObjectPart[] parts = sog.GetParts(); | ||
564 | Assert.That(parts.Length, Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); | ||
565 | |||
566 | db.StoreObject(sog, newregion); | ||
567 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); | ||
568 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); | ||
569 | SceneObjectGroup newsog = sogs[0]; | ||
570 | |||
571 | SceneObjectPart[] newparts = newsog.GetParts(); | ||
572 | Assert.That(newparts.Length, Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); | ||
573 | |||
574 | Assert.That(newsog, Constraints.PropertyCompareConstraint(sog) | ||
575 | .IgnoreProperty(x=>x.LocalId) | ||
576 | .IgnoreProperty(x=>x.HasGroupChanged) | ||
577 | .IgnoreProperty(x=>x.IsSelected) | ||
578 | .IgnoreProperty(x=>x.RegionHandle) | ||
579 | .IgnoreProperty(x=>x.Scene) | ||
580 | .IgnoreProperty(x=>x.RootPart.InventorySerial)); | ||
581 | } | ||
535 | 582 | ||
536 | [Test] | 583 | [Test] |
537 | public void T020_PrimInventoryEmpty() | 584 | public void T020_PrimInventoryEmpty() |
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs index 4e4ddc8..21d1a7e 100644 --- a/OpenSim/Data/Tests/BasicUserTest.cs +++ b/OpenSim/Data/Tests/BasicUserTest.cs | |||
@@ -118,13 +118,6 @@ namespace OpenSim.Data.Tests | |||
118 | } | 118 | } |
119 | 119 | ||
120 | [Test] | 120 | [Test] |
121 | public void T999_StillNull() | ||
122 | { | ||
123 | Assert.That(db.GetUserByUUID(zero), Is.Null); | ||
124 | Assert.That(db.GetAgentByUUID(zero), Is.Null); | ||
125 | } | ||
126 | |||
127 | [Test] | ||
128 | public void T010_CreateUser() | 121 | public void T010_CreateUser() |
129 | { | 122 | { |
130 | UserProfileData u1 = NewUser(user1,fname1,lname1); | 123 | UserProfileData u1 = NewUser(user1,fname1,lname1); |
@@ -396,6 +389,22 @@ namespace OpenSim.Data.Tests | |||
396 | Assert.That(customtype,Is.EqualTo(u1a.CustomType), "Assert.That(customtype,Is.EqualTo(u1a.CustomType))"); | 389 | Assert.That(customtype,Is.EqualTo(u1a.CustomType), "Assert.That(customtype,Is.EqualTo(u1a.CustomType))"); |
397 | Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))"); | 390 | Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))"); |
398 | } | 391 | } |
392 | |||
393 | [Test] | ||
394 | public void T017_UserUpdateRandomPersistency() | ||
395 | { | ||
396 | UUID id = user5; | ||
397 | UserProfileData u = db.GetUserByUUID(id); | ||
398 | ScrambleForTesting.Scramble(u); | ||
399 | u.ID = id; | ||
400 | |||
401 | db.UpdateUserProfile(u); | ||
402 | UserProfileData u1a = db.GetUserByUUID(id); | ||
403 | Assert.That(u1a, Constraints.PropertyCompareConstraint(u) | ||
404 | .IgnoreProperty(x=>x.HomeRegionX) | ||
405 | .IgnoreProperty(x=>x.HomeRegionY) | ||
406 | ); | ||
407 | } | ||
399 | 408 | ||
400 | [Test] | 409 | [Test] |
401 | public void T020_CreateAgent() | 410 | public void T020_CreateAgent() |
@@ -660,6 +669,13 @@ namespace OpenSim.Data.Tests | |||
660 | Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight), "Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight))"); | 669 | Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight), "Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight))"); |
661 | } | 670 | } |
662 | 671 | ||
672 | [Test] | ||
673 | public void T999_StillNull() | ||
674 | { | ||
675 | Assert.That(db.GetUserByUUID(zero), Is.Null); | ||
676 | Assert.That(db.GetAgentByUUID(zero), Is.Null); | ||
677 | } | ||
678 | |||
663 | public UserProfileData NewUser(UUID id,string fname,string lname) | 679 | public UserProfileData NewUser(UUID id,string fname,string lname) |
664 | { | 680 | { |
665 | UserProfileData u = new UserProfileData(); | 681 | UserProfileData u = new UserProfileData(); |