예제 #1
0
        /// <summary>
        /// Creates a <see cref="ConcreteMixedTypeAttribute"/> from a given <see cref="ClassContext"/>.
        /// </summary>
        /// <param name="context">The class context describing the concrete mixed type.</param>
        /// <param name="orderedMixinTypes">The types of the mixins applied to the target class of this attribute in the same order that was used for the
        /// code generation. The mixin types directly match the mixin types defined by <see cref="TargetClassDefinition.Mixins"/>.</param>
        /// <returns>A new <see cref="ConcreteMixedTypeAttribute"/> with the <see cref="ClassContextData"/> property holding a serialized version of
        /// <paramre name="context"/>.</returns>
        public static ConcreteMixedTypeAttribute FromClassContext(ClassContext context, Type[] orderedMixinTypes)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var serializer = new AttributeClassContextSerializer();

            context.Serialize(serializer);

            return(new ConcreteMixedTypeAttribute(serializer.Values, orderedMixinTypes));
        }
 public void SetUp()
 {
     _serializer          = new AttributeClassContextSerializer();
     _invalidDeserializer = new AttributeClassContextDeserializer(new object[] { 1, 2, 3 });
 }