// Always remember: the whole configuration must be serialized as one single, flat object (or SerializationInfo), we cannot rely on any
        // nested objects to be deserialized in the right order
        public static void GetObjectDataForGeneratedTypes(
            SerializationInfo info,
            StreamingContext context,
            object mixin,
            ConcreteMixinTypeIdentifier identifier,
            bool serializeBaseMembers,
            string pipelineIdentifier)
        {
            ArgumentUtility.CheckNotNull("info", info);
            ArgumentUtility.CheckNotNull("mixin", mixin);
            ArgumentUtility.CheckNotNull("identifier", identifier);

            info.SetType(typeof(MixinSerializationHelper));

            var identifierSerializer = new SerializationInfoConcreteMixinTypeIdentifierSerializer(info, "__identifier");

            identifier.Serialize(identifierSerializer);

            object[] baseMemberValues;
            if (serializeBaseMembers)
            {
                var baseType = mixin.GetType().BaseType;
                Assertion.IsNotNull(baseType, "Generated mixin types always have a base type.");
                MemberInfo[] baseMembers = FormatterServices.GetSerializableMembers(baseType);
                baseMemberValues = FormatterServices.GetObjectData(mixin, baseMembers);
            }
            else
            {
                baseMemberValues = null;
            }

            info.AddValue("__baseMemberValues", baseMemberValues);
            info.AddValue("__participantConfigurationID", pipelineIdentifier);
        }
        public void SetUp()
        {
            _simpleMethod  = typeof(BaseType1).GetMethod("VirtualMethod", Type.EmptyTypes);
            _genericMethod = typeof(BaseType7).GetMethod("One");

            _serializationInfo = new SerializationInfo(typeof(ConcreteMixinTypeIdentifier), new FormatterConverter());
            _serializer        = new SerializationInfoConcreteMixinTypeIdentifierSerializer(_serializationInfo, "identifier");
        }
        public void SetUp()
        {
            _simpleMethod  = typeof(BaseType1).GetMethod("VirtualMethod", Type.EmptyTypes);
            _genericMethod = typeof(BaseType7).GetMethod("One");
            _methodOnGenericClosedWithReferenceType = typeof(GenericClassWithAllKindsOfMembers <string>).GetMethod("Method");
            _methodOnGenericClosedWithValueType     = typeof(GenericClassWithAllKindsOfMembers <int>).GetMethod("Method");

            _serializationInfo = new SerializationInfo(typeof(ConcreteMixinTypeIdentifier), new FormatterConverter());
            _serializer        = new SerializationInfoConcreteMixinTypeIdentifierSerializer(_serializationInfo, "identifier");
            _deserializer      = new SerializationInfoConcreteMixinTypeIdentifierDeserializer(_serializationInfo, "identifier");
        }