aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/BasicGridTest.cs
diff options
context:
space:
mode:
authorKunnis2009-08-09 02:01:21 -0500
committerTeravus Ovares (Dan Olivares)2009-08-16 13:35:44 -0400
commit23d478f2fa06d1dedabfb24cf6ff763b586173ce (patch)
tree072fdcfe343d84cf01b0881045fc96fb8403c324 /OpenSim/Data/Tests/BasicGridTest.cs
parentAdd copyright header. Formatting cleanup. (diff)
downloadopensim-SC-23d478f2fa06d1dedabfb24cf6ff763b586173ce.zip
opensim-SC-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.gz
opensim-SC-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.bz2
opensim-SC-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.xz
Adding in Reflection-based testing, to ensure that all properties are covered.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/Tests/BasicGridTest.cs79
1 files changed, 14 insertions, 65 deletions
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();