Ejemplo n.º 1
0
        private void ImplementMixinMethods()
        {
            IEnumerable <Type> mixinTypes = this.mixinsModel.GetMixinTypes();

            foreach (Type mixinType in mixinTypes)
            {
                foreach (MethodInfo method in mixinType.GetMethods())
                {
                    MixinModel mixinModel = this.mixinsModel.ImplementMethod(method);

                    MethodConcernsModel methodConcernsModel      = this.concernsModel.ConcernsFor(method, mixinType);
                    MethodConcernsModel mixinMethodConcernsModel = mixinModel.ConcernsFor(method, mixinType);
                    methodConcernsModel = methodConcernsModel.CombineWith(mixinMethodConcernsModel);

                    MethodSideEffectsModel methodSideEffectsModel      = this.sideEffectsModel.SideEffectsFor(method, mixinType);
                    MethodSideEffectsModel mixinMethodSideEffectsModel = mixinModel.SideEffectsFor(method, mixinType);
                    methodSideEffectsModel = methodSideEffectsModel.CombineWith(mixinMethodSideEffectsModel);

                    var methodConstraintsModel = new MethodConstraintsModel(method, this.constraintsModel);

                    var compositeMethodModel = new CompositeMethodModel(methodConstraintsModel, methodConcernsModel, methodSideEffectsModel, this.mixinsModel);
                    this.methods.Add(method, compositeMethodModel);
                }

                foreach (PropertyInfo property in mixinType.GetProperties())
                {
                    this.properties.Add(property);
                }
            }
        }