public static void NestedArray(int a, int b, int c)
 {
     InitializerTests.X(InitializerTests.Y(), new int[][]
     {
         new int[]
         {
             1,
             2,
             3,
             4,
             5,
             6,
             7,
             8,
             9,
             10
         },
         new int[]
         {
             a,
             b,
             c
         },
         new int[]
         {
             1,
             2,
             3,
             4,
             5,
             6
         }
     });
 }
 public static void ObjectInitializer()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data
     {
         a = InitializerTests.MyEnum.a
     });
 }
 public static void CollectionInitializerList()
 {
     InitializerTests.X(InitializerTests.Y(), new List <int>
     {
         1,
         2,
         3
     });
 }
        public static void NotACollectionInitializer()
        {
            List <int> list = new List <int>();

            list.Add(1);
            list.Add(2);
            list.Add(3);
            InitializerTests.X(InitializerTests.Y(), list);
        }
 public static void ArrayEnum()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.MyEnum[]
     {
         InitializerTests.MyEnum.a,
         InitializerTests.MyEnum.b,
         InitializerTests.MyEnum.a,
         InitializerTests.MyEnum.b
     });
 }
 public static void SimpleDictInitializer()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data {
         MoreData =
         {
             a   = InitializerTests.MyEnum.a,
             [2] = (Data)null
         }
     });
 }
 public static void ArrayString()
 {
     InitializerTests.X(InitializerTests.Y(), new string[]
     {
         "",
         null,
         "Hello",
         "World"
     });
 }
 public static void Array2(int a, int b, int c)
 {
     InitializerTests.X(InitializerTests.Y(), new int[]
     {
         a,
         0,
         b,
         0,
         c
     });
 }
 public static void ArrayLong()
 {
     InitializerTests.X(InitializerTests.Y(), new long[]
     {
         -4999999999999999999L,
         -1L,
         0L,
         1L,
         4999999999999999999L
     });
 }
Exemple #10
0
 public static void ObjectInitializerAssignCollectionToProperty()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data {
         a            = InitializerTests.MyEnum.a,
         PropertyList = new List <InitializerTests.MyEnum2>
         {
             InitializerTests.MyEnum2.c,
             InitializerTests.MyEnum2.d
         }
     });
 }
Exemple #11
0
 public static void ObjectInitializerAddToCollectionInProperty()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data {
         a            = InitializerTests.MyEnum.a,
         PropertyList =
         {
             InitializerTests.MyEnum2.c,
             InitializerTests.MyEnum2.d
         }
     });
 }
 public static void ArrayShort()
 {
     InitializerTests.X(InitializerTests.Y(), new short[]
     {
         -32768,
         -1,
         0,
         1,
         32767
     });
 }
 public static void ArrayDecimal()
 {
     InitializerTests.X(InitializerTests.Y(), new decimal[]
     {
         -100m,
         0m,
         100m,
         -79228162514264337593543950335m,
         79228162514264337593543950335m,
         0.0000001m
     });
 }
 public static void ArrayDouble()
 {
     InitializerTests.X(InitializerTests.Y(), new double[]
     {
         -1.5,
         0.0,
         1.5,
         double.NegativeInfinity,
         double.PositiveInfinity,
         double.NaN
     });
 }
 public static void ArrayFloat()
 {
     InitializerTests.X(InitializerTests.Y(), new float[]
     {
         -1.5f,
         0f,
         1.5f,
         float.NegativeInfinity,
         float.PositiveInfinity,
         float.NaN
     });
 }
 public static void ArrayUShort()
 {
     InitializerTests.X(InitializerTests.Y(), new ushort[]
     {
         0,
         1,
         32767,
         32768,
         65534,
         65535
     });
 }
Exemple #17
0
 public static void ObjectInitializerWithInitializationOfNestedObjects()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data {
         MoreData =
         {
             a        = InitializerTests.MyEnum.a,
             MoreData =
             {
                 a    = InitializerTests.MyEnum.b
             }
         }
     });
 }
 public static void ArrayBoolean()
 {
     InitializerTests.X(InitializerTests.Y(), new bool[]
     {
         true,
         false,
         true,
         false,
         false,
         false,
         true,
         true
     });
 }
 public static void CollectionInitializerDictionaryWithEnumTypes()
 {
     InitializerTests.X(InitializerTests.Y(), new Dictionary <InitializerTests.MyEnum, InitializerTests.MyEnum2>
     {
         {
             InitializerTests.MyEnum.a,
             InitializerTests.MyEnum2.c
         },
         {
             InitializerTests.MyEnum.b,
             InitializerTests.MyEnum2.d
         }
     });
 }
 public static void ArraySByte()
 {
     InitializerTests.X(InitializerTests.Y(), new sbyte[]
     {
         -128,
         -127,
         0,
         1,
         2,
         3,
         4,
         127
     });
 }
 public static void ArrayULong()
 {
     InitializerTests.X(InitializerTests.Y(), new ulong[]
     {
         1uL,
         2000000000uL,
         3000000000uL,
         4uL,
         5uL,
         6uL,
         7uL,
         8uL,
         4999999999999999999uL,
         9999999999999999999uL
     });
 }
 public static void ArrayUInt()
 {
     InitializerTests.X(InitializerTests.Y(), new uint[]
     {
         1u,
         2000000000u,
         3000000000u,
         4u,
         5u,
         6u,
         7u,
         8u,
         9u,
         10u
     });
 }
 public static void ArrayInt()
 {
     InitializerTests.X(InitializerTests.Y(), new int[]
     {
         1,
         -2,
         2000000000,
         4,
         5,
         -6,
         7,
         8,
         9,
         10
     });
 }
 public static void ArrayByte()
 {
     InitializerTests.X(InitializerTests.Y(), new byte[]
     {
         1,
         2,
         3,
         4,
         5,
         6,
         7,
         8,
         254,
         255
     });
 }
 public static void Array1()
 {
     InitializerTests.X(InitializerTests.Y(), new int[]
     {
         1,
         2,
         3,
         4,
         5,
         6,
         7,
         8,
         9,
         10
     });
 }
 public static void CollectionInitializerDictionary()
 {
     InitializerTests.X(InitializerTests.Y(), new Dictionary <string, int>
     {
         {
             "First",
             1
         },
         {
             "Second",
             2
         },
         {
             "Third",
             3
         }
     });
 }
 public unsafe static void NestedPointerArray(int a, int b, int c)
 {
     InitializerTests.X(InitializerTests.Y(), new void *[][]
     {
         new void *[]
         {
             null
         },
         new void *[]
         {
             (void *)200,
             null
         },
         new void *[]
         {
             (void *)100,
             null
         }
     });
 }
 public static void NestedNullableArray(int a, int b, int c)
 {
     InitializerTests.X(InitializerTests.Y(), new int?[][]
     {
         new int?[]
         {
             1,
             2,
             3,
             4,
             5,
             6,
             7,
             8,
             9,
             10,
             null
         },
         new int?[]
         {
             a,
             b,
             c,
             null
         },
         new int?[]
         {
             1,
             2,
             3,
             4,
             5,
             6,
             null
         }
     });
 }
 public static void MixedObjectAndDictInitializer()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data {
         MoreData =
         {
             a          = InitializerTests.MyEnum.a,
 public static void NotAnObjectInitializer()
 {
     InitializerTests.Data data = new InitializerTests.Data();
     data.a = InitializerTests.MyEnum.a;
     InitializerTests.X(InitializerTests.Y(), data);
 }