aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/PropertyCompareConstraint.cs
diff options
context:
space:
mode:
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;