/// <summary> /// Adds the given mixin to the given target type with a number of explicit dependencies and suppressed mixins. This is a shortcut /// method for calling <see cref="ForClass"/>, <see cref="ClassContextBuilder.AddMixin(System.Type,Remotion.Mixins.Context.MixinContextOrigin)"/>, /// <see cref="MixinContextBuilder.WithDependencies"/>, and <see cref="MixinContextBuilder.ReplaceMixins"/> in a row. /// </summary> /// <param name="mixinKind">The kind of relationship the mixin has with its target class.</param> /// <param name="targetType">The target type to add a mixin for.</param> /// <param name="mixinType">The mixin type to add.</param> /// <param name="introducedMemberVisibility">The default visibility to be used for introduced members.</param> /// <param name="explicitDependencies">The explicit dependencies of the mixin in the context of the target type.</param> /// <param name="suppressedMixins">The mixins suppressed by this mixin in the context of the target type.</param> /// <param name="origin">A <see cref="MixinContextOrigin"/> object describing where the mixin configuration originates from.</param> public virtual MixinConfigurationBuilder AddMixinToClass( MixinKind mixinKind, Type targetType, Type mixinType, MemberVisibility introducedMemberVisibility, IEnumerable <Type> explicitDependencies, IEnumerable <Type> suppressedMixins, MixinContextOrigin origin) { ArgumentUtility.CheckNotNull("targetType", targetType); ArgumentUtility.CheckNotNull("mixinType", mixinType); ArgumentUtility.CheckNotNull("explicitDependencies", explicitDependencies); ArgumentUtility.CheckNotNull("suppressedMixins", suppressedMixins); ArgumentUtility.CheckNotNull("origin", origin); MixinContextBuilder mixinContextBuilder = AddMixinToClass(targetType, mixinType, origin); mixinContextBuilder .OfKind(mixinKind) .WithDependencies(explicitDependencies.ToArray()) .WithIntroducedMemberVisibility(introducedMemberVisibility) .ReplaceMixins(suppressedMixins.ToArray()); return(this); }
public void OfKind_Used() { Assert.That(_mixinBuilder.OfKind(MixinKind.Used), Is.SameAs(_mixinBuilder)); Assert.That(_mixinBuilder.MixinKind, Is.EqualTo(MixinKind.Used)); }