コード例 #1
0
        public void ClosureType_Visibility()
        {
            var props = new[] { new KeyValuePair <string, Type>("bar", typeof(Bar)) };

            Assert.ThrowsException <InvalidOperationException>(() => RuntimeCompiler.CreateClosureType(props));
            Assert.ThrowsException <InvalidOperationException>(() => { var rtc = new RuntimeCompiler(); var atb = rtc.GetNewClosureTypeBuilder(); rtc.DefineClosureType(atb, props); });
        }
コード例 #2
0
 public void ClosureType_NonTrivial_Static()
 {
     ClosureType_NonTrivial_Impl(() =>
     {
         return(RuntimeCompiler.CreateClosureType(new[]
         {
             new KeyValuePair <string, Type>("bar", typeof(int)),
             new KeyValuePair <string, Type>("foo", typeof(string)),
         }));
     });
 }
コード例 #3
0
 public void CreateClosureType_ArgumentChecks()
 {
     AssertEx.ThrowsException <ArgumentNullException>(() => RuntimeCompiler.CreateClosureType(fields: null), ex => Assert.AreEqual("fields", ex.ParamName));
 }