/// <summary> /// Creates testdata. /// </summary> /// <returns></returns> public static RootContainer CreateFakeRoot() { var root = new RootContainer(); root.SimpleSByte = -33; root.SimpleInt = 42; root.SimpleSingle = -352; root.SimpleDouble = 42.42; root.SimpleDateTime = new DateTime(2004, 5, 5); root.SimpleTimeSpan = new TimeSpan(5, 4, 3); root.SimpleGuid = Guid.NewGuid(); root.SimpleEnum = SimpleEnum.Three; root.SimpleEnumInheritedFromByte = SimpleEnumInheritedFromByte.ThreeB; root.FlagsEnum = FlagEnum.Alfa | FlagEnum.Beta; root.FlagEnumInheritedFromUInt16 = FlagEnumInheritedFromUInt16.BetaU | FlagEnumInheritedFromUInt16.GammaU; root.SimpleDecimal = Convert.ToDecimal(17.123); root.SimpleString = "sth"; root.EmptyString = string.Empty; root.AdvancedStruct = new AdvancedStruct() { DateTime = new DateTime(2010, 4, 10), SimpleText = "nix" }; ////root.Type = typeof(List<string>); root.SingleArray = new[] { "ala", "ma", null, "kota" }; root.ArrayOfByte = new byte[] { 66, 67, 68, 69, 70, 13, 10, 71, 72, 73, 13, 10, 159, 221 }; root.DoubleArray = new[,] { { "k1", "k2" }, { "b1", "b2" }, { "z1", "z2" } }; root.SingleArrayOfChars = new char[] { 'o', '\t', '\n', (char)0 }; root.PolymorphicSingleArray = new IComplexObject[] { new ComplexObject() { SimpleInt = 999 } }; root.GenericList = new List<string> { "item1", "item2", "item3" }; root.GenericDictionary = new Dictionary<int, string>(); root.GenericDictionary.Add(5, null); root.GenericDictionary.Add(10, "ten"); root.GenericDictionary.Add(20, "twenty"); root.GenericDictionaryOfPolymorphicValues = new Dictionary<int, IComplexObject>(); root.GenericDictionaryOfPolymorphicValues.Add(2012, new ComplexObject() { SimpleInt = 2012000 }); root.ComplexObject = new ComplexObject { SimpleInt = 33 }; root.ComplexObjectWithSelfReference = new ComplexObject { SimpleInt = 794, Name = "Self-Referencing" }; root.ComplexObjectWithSelfReference.OtherComplex = root.ComplexObjectWithSelfReference; root.ListWithSelfReference = new List<object>(); root.ListWithSelfReference.Add(root.ListWithSelfReference); root.ComplexObjectCollection = new ComplexObjectPolymorphicCollection { new ComplexObject { SimpleInt = 11 }, new ComplexObject { SimpleInt = 12 } }; root.ComplexObjectCollectionWithReferences = new ComplexObjectPolymorphicCollection { new ComplexObject { SimpleInt = 1311 }, root.ComplexObjectWithSelfReference, new ComplexObject { SimpleInt = 131212 } }; root.ComplexObjectDictionary = new ComplexObjectPolymorphicDictionary(); root.ComplexObjectDictionary.Add(100, new ComplexObject { SimpleInt = 101 }); root.ComplexObjectDictionary.Add(200, new ComplexObject { SimpleInt = 202 }); root.ComplexObjectDictionary.Add(300, null); root.ComplexObjectDictionaryWithSelfReference = new ComplexObjectExtendedDictionary(); root.ComplexObjectDictionaryWithSelfReference.ReferenceObject = root.ComplexObjectDictionaryWithSelfReference; root.ComplexObjectDictionaryWithSelfReference.Add(44, root.ComplexObjectDictionaryWithSelfReference); root.GenericListOfComplexObjects = new List<IComplexObject> { new ComplexObject { SimpleInt = 303 } }; root.GenericObjectOfComplexObject = new GenericObject<IComplexObject>(new ComplexObject { SimpleInt = 12345 }); root.MultiArrayOfGenericObjectWithPolymorphicArgument = new GenericObject<IComplexObject>[1, 1]; root.MultiArrayOfGenericObjectWithPolymorphicArgument[0, 0] = new GenericObject<IComplexObject>() { Data = new ComplexObject() { SimpleInt = 1357 } }; //root.HashSetOfTypes = new HashSet<Type>(new Type[] {typeof(string), typeof(Type)}); // it contains objects of different types, a nested array and a reference to another array root.SingleArrayOfObjects = new object[] { 42, "nothing to say", false, SimpleEnum.Three, null, new object[] { 42, "nothing to say", false, SimpleEnum.Three, null }, root.MultiArrayOfGenericObjectWithPolymorphicArgument }; return root; }
/// <summary> /// Creates testdata. /// </summary> /// <returns></returns> public static RootContainer CreateFakeRoot() { var root = new RootContainer(); root.SimpleSByte = -33; root.SimpleInt = 42; root.SimpleSingle = -352; root.SimpleDouble = 42.42; root.SimpleDateTime = new DateTime(2004, 5, 5); root.SimpleTimeSpan = new TimeSpan(5, 4, 3); root.SimpleGuid = Guid.NewGuid(); root.SimpleEnum = SimpleEnum.Three; root.SimpleEnumInheritedFromByte = SimpleEnumInheritedFromByte.ThreeB; root.FlagsEnum = FlagEnum.Alfa | FlagEnum.Beta; root.FlagEnumInheritedFromUInt16 = FlagEnumInheritedFromUInt16.BetaU | FlagEnumInheritedFromUInt16.GammaU; root.SimpleDecimal = Convert.ToDecimal(17.123); root.SimpleString = "sth"; root.EmptyString = string.Empty; root.AdvancedStruct = new AdvancedStruct() { DateTime = new DateTime(2010, 4, 10), SimpleText = "nix" }; ////root.Type = typeof(List<string>); root.SingleArray = new[] { "ala", "ma", null, "kota" }; root.ArrayOfByte = new byte[] { 66, 67, 68, 69, 70, 13, 10, 71, 72, 73, 13, 10, 159, 221 }; root.DoubleArray = new[, ] { { "k1", "k2" }, { "b1", "b2" }, { "z1", "z2" } }; root.SingleArrayOfChars = new char[] { 'o', '\t', '\n', (char)0 }; root.PolymorphicSingleArray = new IComplexObject[] { new ComplexObject() { SimpleInt = 999 } }; root.GenericList = new List <string> { "item1", "item2", "item3" }; root.GenericDictionary = new Dictionary <int, string>(); root.GenericDictionary.Add(5, null); root.GenericDictionary.Add(10, "ten"); root.GenericDictionary.Add(20, "twenty"); root.GenericDictionaryOfPolymorphicValues = new Dictionary <int, IComplexObject>(); root.GenericDictionaryOfPolymorphicValues.Add(2012, new ComplexObject() { SimpleInt = 2012000 }); root.ComplexObject = new ComplexObject { SimpleInt = 33 }; root.ComplexObjectWithSelfReference = new ComplexObject { SimpleInt = 794, Name = "Self-Referencing" }; root.ComplexObjectWithSelfReference.OtherComplex = root.ComplexObjectWithSelfReference; root.ListWithSelfReference = new List <object>(); root.ListWithSelfReference.Add(root.ListWithSelfReference); root.ComplexObjectCollection = new ComplexObjectPolymorphicCollection { new ComplexObject { SimpleInt = 11 }, new ComplexObject { SimpleInt = 12 } }; root.ComplexObjectCollectionWithReferences = new ComplexObjectPolymorphicCollection { new ComplexObject { SimpleInt = 1311 }, root.ComplexObjectWithSelfReference, new ComplexObject { SimpleInt = 131212 } }; root.ComplexObjectDictionary = new ComplexObjectPolymorphicDictionary(); root.ComplexObjectDictionary.Add(100, new ComplexObject { SimpleInt = 101 }); root.ComplexObjectDictionary.Add(200, new ComplexObject { SimpleInt = 202 }); root.ComplexObjectDictionary.Add(300, null); root.ComplexObjectDictionaryWithSelfReference = new ComplexObjectExtendedDictionary(); root.ComplexObjectDictionaryWithSelfReference.ReferenceObject = root.ComplexObjectDictionaryWithSelfReference; root.ComplexObjectDictionaryWithSelfReference.Add(44, root.ComplexObjectDictionaryWithSelfReference); root.GenericListOfComplexObjects = new List <IComplexObject> { new ComplexObject { SimpleInt = 303 } }; root.GenericObjectOfComplexObject = new GenericObject <IComplexObject>(new ComplexObject { SimpleInt = 12345 }); root.MultiArrayOfGenericObjectWithPolymorphicArgument = new GenericObject <IComplexObject> [1, 1]; root.MultiArrayOfGenericObjectWithPolymorphicArgument[0, 0] = new GenericObject <IComplexObject>() { Data = new ComplexObject() { SimpleInt = 1357 } }; //root.HashSetOfTypes = new HashSet<Type>(new Type[] {typeof(string), typeof(Type)}); // it contains objects of different types, a nested array and a reference to another array root.SingleArrayOfObjects = new object[] { 42, "nothing to say", false, SimpleEnum.Three, null, new object[] { 42, "nothing to say", false, SimpleEnum.Three, null }, root.MultiArrayOfGenericObjectWithPolymorphicArgument }; return(root); }