aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/PropertyScrambler.cs
diff options
context:
space:
mode:
authorJeff Ames2009-08-17 10:29:06 +0900
committerJeff Ames2009-08-17 10:29:06 +0900
commit82c888fc6c103ec345bf656cd469f4260b678bcb (patch)
treee36ea04103469ba31501e7a7fe3b10e5e856dbe5 /OpenSim/Data/Tests/PropertyScrambler.cs
parentAdd UUIDs in bin/ScriptEngines to .gitignore. (diff)
downloadopensim-SC_OLD-82c888fc6c103ec345bf656cd469f4260b678bcb.zip
opensim-SC_OLD-82c888fc6c103ec345bf656cd469f4260b678bcb.tar.gz
opensim-SC_OLD-82c888fc6c103ec345bf656cd469f4260b678bcb.tar.bz2
opensim-SC_OLD-82c888fc6c103ec345bf656cd469f4260b678bcb.tar.xz
Add copyright headers. Formatting cleanup. Fix a compiler warning.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/Tests/PropertyScrambler.cs35
1 files changed, 31 insertions, 4 deletions
diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs
index c56c10f..72aaff1 100644
--- a/OpenSim/Data/Tests/PropertyScrambler.cs
+++ b/OpenSim/Data/Tests/PropertyScrambler.cs
@@ -1,3 +1,30 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
1using System; 28using System;
2using System.Collections; 29using System.Collections;
3using System.Collections.Generic; 30using System.Collections.Generic;
@@ -20,7 +47,7 @@ namespace OpenSim.Data.Tests
20 private void AddExpressionToNotScrableList(Expression expression) 47 private void AddExpressionToNotScrableList(Expression expression)
21 { 48 {
22 UnaryExpression unaryExpression = expression as UnaryExpression; 49 UnaryExpression unaryExpression = expression as UnaryExpression;
23 if(unaryExpression != null) 50 if (unaryExpression != null)
24 { 51 {
25 AddExpressionToNotScrableList(unaryExpression.Operand); 52 AddExpressionToNotScrableList(unaryExpression.Operand);
26 return; 53 return;
@@ -58,7 +85,7 @@ namespace OpenSim.Data.Tests
58 { 85 {
59 //Skip indexers of classes. We will assume that everything that has an indexer 86 //Skip indexers of classes. We will assume that everything that has an indexer
60 // is also IEnumberable. May not always be true, but should be true normally. 87 // is also IEnumberable. May not always be true, but should be true normally.
61 if(property.GetIndexParameters().Length > 0) 88 if (property.GetIndexParameters().Length > 0)
62 continue; 89 continue;
63 90
64 RandomizeProperty(obj, property, null); 91 RandomizeProperty(obj, property, null);
@@ -66,7 +93,7 @@ namespace OpenSim.Data.Tests
66 //Now if it implments IEnumberable, it's probably some kind of list, so we should randomize 93 //Now if it implments IEnumberable, it's probably some kind of list, so we should randomize
67 // everything inside of it. 94 // everything inside of it.
68 IEnumerable enumerable = obj as IEnumerable; 95 IEnumerable enumerable = obj as IEnumerable;
69 if(enumerable != null) 96 if (enumerable != null)
70 { 97 {
71 foreach (object value in enumerable) 98 foreach (object value in enumerable)
72 { 99 {
@@ -78,7 +105,7 @@ namespace OpenSim.Data.Tests
78 private readonly Random random = new Random(); 105 private readonly Random random = new Random();
79 private void RandomizeProperty(object obj, PropertyInfo property, object[] index) 106 private void RandomizeProperty(object obj, PropertyInfo property, object[] index)
80 {//I'd like a better way to compare, but I had lots of problems with InventoryFolderBase because the ID is inherited. 107 {//I'd like a better way to compare, but I had lots of problems with InventoryFolderBase because the ID is inherited.
81 if(membersToNotScramble.Contains(property.Name)) 108 if (membersToNotScramble.Contains(property.Name))
82 return; 109 return;
83 Type t = property.PropertyType; 110 Type t = property.PropertyType;
84 if (!property.CanWrite) 111 if (!property.CanWrite)