diff options
author | Teravus Ovares (Dan Olivares) | 2010-09-18 03:42:37 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2010-09-18 03:42:37 -0400 |
commit | 27d5976b87d38c7a90d95549a358011349a219f7 (patch) | |
tree | bebdb2fafa5700f5026b33033ac2e830e858562e /OpenSim/Framework | |
parent | * Covered the type converters in SLUtil with unit tests. (diff) | |
download | opensim-SC-27d5976b87d38c7a90d95549a358011349a219f7.zip opensim-SC-27d5976b87d38c7a90d95549a358011349a219f7.tar.gz opensim-SC-27d5976b87d38c7a90d95549a358011349a219f7.tar.bz2 opensim-SC-27d5976b87d38c7a90d95549a358011349a219f7.tar.xz |
* Tweaked the LocationTests for maximum coverage.
* Added more mundane tests.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Tests/LocationTest.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 42 |
2 files changed, 60 insertions, 1 deletions
diff --git a/OpenSim/Framework/Tests/LocationTest.cs b/OpenSim/Framework/Tests/LocationTest.cs index 237568f..2707afa 100644 --- a/OpenSim/Framework/Tests/LocationTest.cs +++ b/OpenSim/Framework/Tests/LocationTest.cs | |||
@@ -54,9 +54,28 @@ namespace OpenSim.Framework.Tests | |||
54 | Location TestLocation2 = new Location(1099511628032000); | 54 | Location TestLocation2 = new Location(1099511628032000); |
55 | Assert.That(TestLocation1 == TestLocation2); | 55 | Assert.That(TestLocation1 == TestLocation2); |
56 | 56 | ||
57 | Assert.That(TestLocation2.X == 256000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided"); | ||
58 | |||
59 | Assert.That(TestLocation2.RegionHandle == 1099511628032000, | ||
60 | "Location RegionHandle Property didn't match regionhandle provided in constructor"); | ||
61 | |||
62 | |||
57 | TestLocation1 = new Location(256001, 256001); | 63 | TestLocation1 = new Location(256001, 256001); |
58 | TestLocation2 = new Location(1099511628032000); | 64 | TestLocation2 = new Location(1099511628032000); |
59 | Assert.That(TestLocation1 != TestLocation2); | 65 | Assert.That(TestLocation1 != TestLocation2); |
66 | |||
67 | Assert.That(TestLocation1.Equals(256001, 256001), "Equals(x,y) failed to match the position in the constructor"); | ||
68 | |||
69 | Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode"); | ||
70 | |||
71 | Location TestLocation3; | ||
72 | object cln = TestLocation2.Clone(); | ||
73 | TestLocation3 = (Location) cln; | ||
74 | Assert.That(TestLocation3.X == TestLocation2.X && TestLocation3.Y == TestLocation2.Y, | ||
75 | "Cloned Location values do not match"); | ||
76 | |||
77 | Assert.That(TestLocation2.Equals(cln), "Cloned object failed .Equals(obj) Test"); | ||
78 | |||
60 | } | 79 | } |
61 | 80 | ||
62 | } | 81 | } |
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index 0c588eb..04be083 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs | |||
@@ -30,6 +30,8 @@ using OpenSim.Framework; | |||
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | 31 | using OpenMetaverse.StructuredData; |
32 | using System; | 32 | using System; |
33 | using System.Globalization; | ||
34 | using System.Threading; | ||
33 | 35 | ||
34 | namespace OpenSim.Framework.Tests | 36 | namespace OpenSim.Framework.Tests |
35 | { | 37 | { |
@@ -265,7 +267,45 @@ namespace OpenSim.Framework.Tests | |||
265 | Assert.That(fld.Owner == uuid2, "ID,Owner constructor failed to save value in ID field."); | 267 | Assert.That(fld.Owner == uuid2, "ID,Owner constructor failed to save value in ID field."); |
266 | } | 268 | } |
267 | 269 | ||
268 | 270 | [Test] | |
271 | public void AsssetBaseConstructorTest01() | ||
272 | { | ||
273 | AssetBase abase = new AssetBase(); | ||
274 | Assert.IsNotNull(abase.Metadata, "void constructor of AssetBase should have created a MetaData element but didn't."); | ||
275 | UUID itemID = UUID.Random(); | ||
276 | UUID creatorID = UUID.Random(); | ||
277 | abase = new AssetBase(itemID.ToString(), "test item", (sbyte) AssetType.Texture, creatorID.ToString()); | ||
278 | |||
279 | Assert.IsNotNull(abase.Metadata, "string,string,sbyte,string constructor of AssetBase should have created a MetaData element but didn't."); | ||
280 | Assert.That(abase.ID == itemID.ToString(), "string,string,sbyte,string constructor failed to set ID property"); | ||
281 | Assert.That(abase.Metadata.CreatorID == creatorID.ToString(), "string,string,sbyte,string constructor failed to set Creator ID"); | ||
282 | |||
283 | |||
284 | abase = new AssetBase(itemID.ToString(), "test item", -1, creatorID.ToString()); | ||
285 | Assert.IsNotNull(abase.Metadata, "string,string,sbyte,string constructor of AssetBase with unknown type should have created a MetaData element but didn't."); | ||
286 | Assert.That(abase.Metadata.Type == -1, "Unknown Type passed to string,string,sbyte,string constructor and was a known type when it came out again"); | ||
287 | |||
288 | AssetMetadata metts = new AssetMetadata(); | ||
289 | metts.FullID = itemID; | ||
290 | metts.ID = string.Empty; | ||
291 | metts.Name = "test item"; | ||
292 | abase.Metadata = metts; | ||
293 | |||
294 | Assert.That(abase.ToString() == itemID.ToString(), "ToString is overriden to be fullID.ToString()"); | ||
295 | Assert.That(abase.ID == itemID.ToString(),"ID should be MetaData.FullID.ToString() when string.empty or null is provided to the ID property"); | ||
296 | } | ||
297 | |||
298 | [Test] | ||
299 | public void CultureSetCultureTest01() | ||
300 | { | ||
301 | CultureInfo ci = new CultureInfo("en-US", false); | ||
302 | Culture.SetCurrentCulture(); | ||
303 | Assert.That(Thread.CurrentThread.CurrentCulture.Name == ci.Name, "SetCurrentCulture failed to set thread culture to en-US"); | ||
304 | |||
305 | } | ||
306 | |||
307 | |||
308 | |||
269 | } | 309 | } |
270 | } | 310 | } |
271 | 311 | ||