Example #1
0
 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
         }
     });
 }
Example #2
0
 public static void ObjectInitializer()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data
     {
         a = InitializerTests.MyEnum.a
     });
 }
Example #3
0
 public static void StructInitializer_DefaultConstructor()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.StructData
     {
         Field    = 1,
         Property = 2
     });
 }
Example #4
0
 public static void StructInitializer_ExplicitConstructor()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.StructData(0)
     {
         Field    = 1,
         Property = 2
     });
 }
Example #5
0
 public static void CollectionInitializerList()
 {
     InitializerTests.X(InitializerTests.Y(), new List <int>
     {
         1,
         2,
         3
     });
 }
Example #6
0
    public static void NotACollectionInitializer()
    {
        List <int> list = new List <int>();

        list.Add(1);
        list.Add(2);
        list.Add(3);
        InitializerTests.X(InitializerTests.Y(), list);
    }
Example #7
0
 public static void ArrayString()
 {
     InitializerTests.X(InitializerTests.Y(), new string[]
     {
         "",
         null,
         "Hello",
         "World"
     });
 }
Example #8
0
 public static void ArrayEnum()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.MyEnum[]
     {
         InitializerTests.MyEnum.a,
         InitializerTests.MyEnum.b,
         InitializerTests.MyEnum.a,
         InitializerTests.MyEnum.b
     });
 }
Example #9
0
 public static void ObjectInitializerWithInitializationOfNestedObjects()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data
     {
         MoreData =
         {
             a = InitializerTests.MyEnum.a
         }
     });
 }
Example #10
0
 public static void ArrayLong()
 {
     InitializerTests.X(InitializerTests.Y(), new long[]
     {
         -4999999999999999999L,
         -1L,
         0L,
         1L,
         4999999999999999999L
     });
 }
Example #11
0
 public static void ArrayShort()
 {
     InitializerTests.X(InitializerTests.Y(), new short[]
     {
         -32768,
         -1,
         0,
         1,
         32767
     });
 }
Example #12
0
 public static void Array2(int a, int b, int c)
 {
     InitializerTests.X(InitializerTests.Y(), new int[]
     {
         a,
         0,
         b,
         0,
         c
     });
 }
Example #13
0
 public static void StructInitializerWithinObjectInitializer()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data
     {
         NestedStruct = new InitializerTests.StructData(2)
         {
             Field    = 1,
             Property = 2
         }
     });
 }
Example #14
0
 public static void ArrayDecimal()
 {
     InitializerTests.X(InitializerTests.Y(), new decimal[]
     {
         -100m,
         0m,
         100m,
         -79228162514264337593543950335m,
         79228162514264337593543950335m,
         0.0000001m
     });
 }
Example #15
0
 public static void ArrayFloat()
 {
     InitializerTests.X(InitializerTests.Y(), new float[]
     {
         -1.5f,
         0f,
         1.5f,
         float.NegativeInfinity,
         float.PositiveInfinity,
         float.NaN
     });
 }
Example #16
0
 public static void ObjectInitializerAddToCollectionInProperty()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data
     {
         a            = InitializerTests.MyEnum.a,
         PropertyList =
         {
             InitializerTests.MyEnum2.c,
             InitializerTests.MyEnum2.d
         }
     });
 }
Example #17
0
 public static void ArrayUShort()
 {
     InitializerTests.X(InitializerTests.Y(), new ushort[]
     {
         0,
         1,
         32767,
         32768,
         65534,
         65535
     });
 }
Example #18
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
         }
     });
 }
Example #19
0
 public static void ArrayDouble()
 {
     InitializerTests.X(InitializerTests.Y(), new double[]
     {
         -1.5,
         0.0,
         1.5,
         double.NegativeInfinity,
         double.PositiveInfinity,
         double.NaN
     });
 }
Example #20
0
 public static void ArraySByte()
 {
     InitializerTests.X(InitializerTests.Y(), new sbyte[]
     {
         -128,
         -127,
         0,
         1,
         2,
         3,
         4,
         127
     });
 }
Example #21
0
 public static void ArrayBoolean()
 {
     InitializerTests.X(InitializerTests.Y(), new bool[]
     {
         true,
         false,
         true,
         false,
         false,
         false,
         true,
         true
     });
 }
Example #22
0
 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
         }
     });
 }
Example #23
0
 public static void StructInitializerWithInitializationOfNestedObjects()
 {
     InitializerTests.X(InitializerTests.Y(), new InitializerTests.StructData
     {
         MoreData =
         {
             a         = InitializerTests.MyEnum.a,
             FieldList =
             {
                 InitializerTests.MyEnum2.c,
                 InitializerTests.MyEnum2.d
             }
         }
     });
 }
Example #24
0
 public static void Array1()
 {
     InitializerTests.X(InitializerTests.Y(), new int[]
     {
         1,
         2,
         3,
         4,
         5,
         6,
         7,
         8,
         9,
         10
     });
 }
Example #25
0
 public static void ArrayByte()
 {
     InitializerTests.X(InitializerTests.Y(), new byte[]
     {
         1,
         2,
         3,
         4,
         5,
         6,
         7,
         8,
         254,
         255
     });
 }
Example #26
0
 public static void ArrayInt()
 {
     InitializerTests.X(InitializerTests.Y(), new int[]
     {
         1,
         -2,
         2000000000,
         4,
         5,
         -6,
         7,
         8,
         9,
         10
     });
 }
Example #27
0
 public static void ArrayUInt()
 {
     InitializerTests.X(InitializerTests.Y(), new uint[]
     {
         1u,
         2000000000u,
         3000000000u,
         4u,
         5u,
         6u,
         7u,
         8u,
         9u,
         10u
     });
 }
Example #28
0
 public static void ArrayULong()
 {
     InitializerTests.X(InitializerTests.Y(), new ulong[]
     {
         1uL,
         2000000000uL,
         3000000000uL,
         4uL,
         5uL,
         6uL,
         7uL,
         8uL,
         4999999999999999999uL,
         9999999999999999999uL
     });
 }
Example #29
0
 public static void CollectionInitializerDictionary()
 {
     InitializerTests.X(InitializerTests.Y(), new Dictionary <string, int>
     {
         {
             "First",
             1
         },
         {
             "Second",
             2
         },
         {
             "Third",
             3
         }
     });
 }
Example #30
0
 public static void NotAObjectInitializer()
 {
     InitializerTests.Data data = new InitializerTests.Data();
     data.a = InitializerTests.MyEnum.a;
     InitializerTests.X(InitializerTests.Y(), data);
 }