public void CreateInterceptableEvent_Adds_Fields_Event_Methods_And_Mapping()
        {
            var moduleScope    = new ModuleScope();
            var generator      = new ProxyGenerator(moduleScope);
            var typeDefinition = generator.GetTypeDefinition(typeof(TypeScope1), null, null);

            TypeBuilder typeBulder = moduleScope.Module.DefineType(typeDefinition.FullName, typeDefinition.TypeAttributes);

            var proxyScope = new ProxyScope(moduleScope, typeBulder, typeDefinition);

            //  proxyScope.DefineTypeAndMembers();

            proxyScope.GetType().GetMethod("CreateFields", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(proxyScope, new object[0]);

            Assert.AreEqual(1, proxyScope.Fields.Count);
            Assert.AreEqual(0, proxyScope.Properties.Count);
            Assert.AreEqual(0, proxyScope.Methods.Count);

            var er = proxyScope.CreateInterceptableEvent(typeDefinition.EventDefinitions[0]);

            Assert.AreEqual(4, proxyScope.Fields.Count);
            Assert.AreEqual("TypeScope1_MyEvent", proxyScope.Fields[1].Name);
            Assert.AreEqual("TypeScope1_Proxy_add_MyEvent", proxyScope.Fields[2].Name);
            Assert.AreEqual("TypeScope1_Proxy_remove_MyEvent", proxyScope.Fields[3].Name);

            Assert.AreEqual(4, proxyScope.Methods.Count);
            Assert.AreEqual("add_MyEvent_Callback", proxyScope.Methods[0].Name);
            Assert.AreEqual("add_MyEvent", proxyScope.Methods[1].Name);
            Assert.AreEqual("remove_MyEvent_Callback", proxyScope.Methods[2].Name);
            Assert.AreEqual("remove_MyEvent", proxyScope.Methods[3].Name);

            var acc = new TypeAccessor(proxyScope);

            var mappings = acc.Fields["eventMappings"].GetValue() as List <EventMapping>;

            Assert.AreEqual(1, mappings.Count);
            Assert.AreEqual("TypeScope1_MyEvent", mappings[0].MemberField.Name);
            Assert.AreEqual("TypeScope1_Proxy_add_MyEvent", mappings[0].AddMethodField.Name);
            Assert.AreEqual("TypeScope1_Proxy_remove_MyEvent", mappings[0].RemoveMethodField.Name);

            Assert.AreEqual("MyEvent", mappings[0].Event.Name);
            Assert.AreEqual("add_MyEvent", mappings[0].AddMethodBuilder.Name);
            Assert.AreEqual("remove_MyEvent", mappings[0].RemoveMethodBuilder.Name);
        }