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); }); }
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)), })); }); }
public void CreateClosureType_ArgumentChecks() { AssertEx.ThrowsException <ArgumentNullException>(() => RuntimeCompiler.CreateClosureType(fields: null), ex => Assert.AreEqual("fields", ex.ParamName)); }