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