Exemplo n.º 1
0
        /// <summary>
        /// Collects the given types as mixins for the <see cref="TargetType"/> and adds dependencies between the mixins to ensure a proper base call
        /// order.
        /// </summary>
        /// <param name="mixinTypes">The mixin types to collect with dependencies.</param>
        /// <param name="origin">A <see cref="MixinContextOrigin"/> object describing where the mixin configuration originates from.</param>
        /// <returns>This object for further configuration of the <see cref="TargetType"/>.</returns>
        public virtual ClassContextBuilder AddOrderedMixins(MixinContextOrigin origin, params Type[] mixinTypes)
        {
            ArgumentUtility.CheckNotNull("origin", origin);
            ArgumentUtility.CheckNotNull("mixinTypes", mixinTypes);

            Type lastMixinType = null;

            foreach (Type mixinType in mixinTypes)
            {
                MixinContextBuilder mixinContextBuilder = AddMixin(mixinType, origin);
                if (lastMixinType != null)
                {
                    mixinContextBuilder.WithDependency(lastMixinType);
                }
                lastMixinType = mixinType;
            }
            return(this);
        }
 public void WithDependency_NonGeneric()
 {
     _mixinBuilder.WithDependency(typeof(BT1Mixin1));
     Assert.That(_mixinBuilder.Dependencies, Is.EquivalentTo(new object[] { typeof(BT1Mixin1) }));
 }