aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/PropertyCompareConstraint.cs
diff options
context:
space:
mode:
authorKunnis2009-08-15 10:54:48 -0500
committerTeravus Ovares (Dan Olivares)2009-08-16 14:17:29 -0400
commitd2e5380cb2325ad42917c528c52a8ad42ec0176f (patch)
tree614ef74c8083db2afb1384b2acba0108e493b6c7 /OpenSim/Data/Tests/PropertyCompareConstraint.cs
parent* Modified SQLite/SQLiteInventoryStore.cs to not throw if the inventory row d... (diff)
downloadopensim-SC_OLD-d2e5380cb2325ad42917c528c52a8ad42ec0176f.zip
opensim-SC_OLD-d2e5380cb2325ad42917c528c52a8ad42ec0176f.tar.gz
opensim-SC_OLD-d2e5380cb2325ad42917c528c52a8ad42ec0176f.tar.bz2
opensim-SC_OLD-d2e5380cb2325ad42917c528c52a8ad42ec0176f.tar.xz
* Fixed MySQL/MySQLAssetData.cs to properly do updates * Removed an extra parameter from MySQL/MySQLInventoryData.cs * Fixed a bug in SQLite/SQLiteAssetData.cs that was causing a NRE when updating an asset. * Improved the BasicAssetTest.cs to do full create/update/get testing * Improved the BasicInventoryTest.cs to do full create/update/get of both a folder and an item * Moved the null ref tests to the start of the PropertyCompareConstraint.cs, so that it doesn't throw when passing in a null item
Diffstat (limited to 'OpenSim/Data/Tests/PropertyCompareConstraint.cs')
-rw-r--r--OpenSim/Data/Tests/PropertyCompareConstraint.cs28
1 files changed, 13 insertions, 15 deletions
diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
index 5f53725..d64a51e 100644
--- a/OpenSim/Data/Tests/PropertyCompareConstraint.cs
+++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
@@ -69,6 +69,19 @@ namespace OpenSim.Data.Tests
69 69
70 private bool ObjectCompare(object expected, object actual, Stack<string> propertyNames) 70 private bool ObjectCompare(object expected, object actual, Stack<string> propertyNames)
71 { 71 {
72 //If they are both null, they are equal
73 if (actual == null && expected == null)
74 return true;
75
76 //If only one is null, then they aren't
77 if (actual == null || expected == null)
78 {
79 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
80 failingActual = actual;
81 failingExpected = expected;
82 return false;
83 }
84
72 //prevent loops... 85 //prevent loops...
73 if(propertyNames.Count > 50) 86 if(propertyNames.Count > 50)
74 { 87 {
@@ -195,21 +208,6 @@ namespace OpenSim.Data.Tests
195 object actualValue = property.GetValue(actual, null); 208 object actualValue = property.GetValue(actual, null);
196 object expectedValue = property.GetValue(expected, null); 209 object expectedValue = property.GetValue(expected, null);
197 210
198 //If they are both null, they are equal
199 if (actualValue == null && expectedValue == null)
200 continue;
201
202 //If only one is null, then they aren't
203 if (actualValue == null || expectedValue == null)
204 {
205 propertyNames.Push(property.Name);
206 failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
207 propertyNames.Pop();
208 failingActual = actualValue;
209 failingExpected = expectedValue;
210 return false;
211 }
212
213 propertyNames.Push(property.Name); 211 propertyNames.Push(property.Name);
214 if (!ObjectCompare(expectedValue, actualValue, propertyNames)) 212 if (!ObjectCompare(expectedValue, actualValue, propertyNames))
215 return false; 213 return false;