示例#1
0
        public static void NotAnObjectInitializer()
        {
            Data data = new Data();

            data.a = MyEnum.a;
            InitializerTests.X(InitializerTests.Y(), data);
        }
示例#2
0
 public static void CollectionInitializerList()
 {
     InitializerTests.X(InitializerTests.Y(), new List <int> {
         1,
         2,
         3
     });
 }
示例#3
0
        public static void NotAnObjectInitializerWithEvent()
        {
            Data data = new Data();

            data.TestEvent += delegate {
                Console.WriteLine();
            };
            InitializerTests.X(InitializerTests.Y(), data);
        }
示例#4
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);
        }
示例#5
0
 public static void SimpleDictInitializer()
 {
     InitializerTests.X(InitializerTests.Y(), new Data {
         MoreData =
         {
             a   = MyEnum.a,
             [2] = null
         }
     });
 }
示例#6
0
 public static void ObjectInitializerAssignCollectionToProperty()
 {
     InitializerTests.X(InitializerTests.Y(), new Data {
         a            = MyEnum.a,
         PropertyList = new List <MyEnum2> {
             MyEnum2.c,
             MyEnum2.d
         }
     });
 }
示例#7
0
 public static void ObjectInitializerAddToCollectionInProperty()
 {
     InitializerTests.X(InitializerTests.Y(), new Data {
         a            = MyEnum.a,
         PropertyList =
         {
             MyEnum2.c,
             MyEnum2.d
         }
     });
 }
示例#8
0
 public static void ObjectInitializerWithInitializationOfNestedObjects()
 {
     InitializerTests.X(InitializerTests.Y(), new Data {
         MoreData =
         {
             a        = MyEnum.a,
             MoreData =
             {
                 a    = MyEnum.b
             }
         }
     });
 }
示例#9
0
 public static void CollectionInitializerDictionaryWithEnumTypes()
 {
     InitializerTests.X(InitializerTests.Y(), new Dictionary <MyEnum, MyEnum2> {
         {
             MyEnum.a,
             MyEnum2.c
         },
         {
             MyEnum.b,
             MyEnum2.d
         }
     });
 }
示例#10
0
 public static void CollectionInitializerDictionary()
 {
     InitializerTests.X(InitializerTests.Y(), new Dictionary <string, int> {
         {
             "First",
             1
         },
         {
             "Second",
             2
         },
         {
             "Third",
             3
         }
     });
 }
示例#11
0
 public static void MixedObjectAndDictInitializer()
 {
     InitializerTests.X(InitializerTests.Y(), new Data {
         MoreData =
         {
             a             = MyEnum.a,
示例#12
0
 public static void ObjectInitializer()
 {
     InitializerTests.X(InitializerTests.Y(), new Data {
         a = MyEnum.a
     });
 }