Esempio n. 1
0
 public IMemberBuilder GetOrAddInferedMember(IKey name, IMemberBuilder memberBuilder)
 {
     if (finalizableScope.IsFinal)
     {
         throw new ApplicationException("bug: don't add after finalize");
     }
     return(inferedMembers.GetOrAdd(memberBuilder.Key, memberBuilder));
 }
 protected MemberBuilder(IMemberBuilder parent, IMember member)
 {
     Parent     = parent;
     Member     = member;
     Assignment = new AssignmentFrame {
         Builder = this
     };
 }
Esempio n. 3
0
        /// <summary>
        /// Gets the builder data specific to this builders key.
        /// </summary>
        /// <typeparam name="T">Type of the <see cref="IMemberBuilder"/></typeparam>
        /// <param name="builder">The builder.</param>
        /// <returns>
        /// The builder data with the <see cref="TestKey"/> or <c>null</c> if nothing is found.
        /// </returns>
        public T GetBuilderData <T>(IMemberBuilder builder) where T : class, IBuilderData
        {
            var          dic = this.BuildData.General;
            IBuilderData userData;

            dic.TryGetValue(builder.GetType().FullName, out userData);

            // var userData = this.BuildData.General[builder.GetType().FullName];
            // as PropertyBuilderUserParameters;
            return(userData as T);
        }
Esempio n. 4
0
        public void SetUp()
        {
            this.mocks = new MockRepository();

            this.buildContext  = this.mocks.StrictMock <IMemberBuildContext>();
            this.builder       = this.mocks.StrictMock <IMemberBuilder>();
            this.type          = this.builder.GetType();
            this.handlerReturn = false;
            handler            = (e) => { return(this.handlerReturn); };
            this.testObject    = new BuildHandler(this.type, handler, typeof(EmptyBuildParameters));
        }
Esempio n. 5
0
        /// <summary>
        /// Creates a new instance of the <see cref="IMemberBuilder"/> specified in the <see cref="Type"/> property with
        /// the specified context data.
        /// </summary>
        /// <param name="context">The context of the current test object.</param>
        /// <returns>
        /// A test member builder that can handle the request specified in the <see cref="CanHandle"/> method.
        /// </returns>
        public IMemberBuilder CreateInstance(IMemberBuildContext context)
        {
            var            parameters    = new object[] { context };
            IMemberBuilder memberBuilder = null;

            //try
            {
                var inst = Activator.CreateInstance(this.Type, parameters);
                memberBuilder = (IMemberBuilder)inst;
            }
            //catch (Exception ex)
            //{
            //}
            return(memberBuilder);
        }
 public IPropertyBuilder CreateBuilder(IMemberBuilder parent)
 {
     return(new AlienPropertyBuilder(_alienType, parent, _alienProperty));
 }
 public AlienPropertyBuilder(IMember owner, IMemberBuilder parentBuilder, IProperty alienProperty)
     : base(parentBuilder, alienProperty)
 {
     _parentBuilder = (IKeepSurrogateInstances)parentBuilder;
     _surrogatedTypeBuilder = _parentBuilder.Surrogates[owner];
 }
Esempio n. 8
0
 /// <summary>
 /// Determines whether this instance holds data for the specified builder type.
 /// </summary>
 /// <param name="builder">The requesting builder.</param>
 /// <returns>
 /// <c>true</c> if this instance holds data for the specified builder type; otherwise, <c>false</c>.
 /// </returns>
 public bool HasDataForType(IMemberBuilder builder)
 {
     return builder is PropertyBuilder;
 }
Esempio n. 9
0
 public PropertyWithSurrogatesBuilder(IProperty property, IMemberBuilder parent, IEnumerable <IType> alienTypes)
     : base(parent, property)
 {
     Surrogates = alienTypes.ToDictionary(x => (IMember)x, x => (ISurrogate)x.CreateInstance());
 }
 public IPropertyBuilder CreateBuilder(IMemberBuilder parentBuilder)
 {
     return(new PropertyWithSurrogatesBuilder(this, parentBuilder, AlienTypes));
 }
 public PropertyWithSurrogatesBuilder(IProperty property, IMemberBuilder parent, IEnumerable<IType> alienTypes)
     : base(parent, property)
 {
     Surrogates = alienTypes.ToDictionary(x => (IMember)x, x => (ISurrogate)x.CreateInstance());
 }
 public IPropertyBuilder CreateBuilder(IMemberBuilder builder)
 {
     return(_property.CreateBuilder(builder));
 }
Esempio n. 13
0
 public Builder(IMemberBuilder memberBuilder) => _memberBuilder = memberBuilder;
        /*/// <summary>
         * /// Deserializes the specified XML to the current instance.
         * /// </summary>
         * /// <param name="xml">The XML text, representing the data.</param>
         * public override void Deserialize(string xml)
         * {
         *  //base.Deserialize(xml);
         *  PropertyBuilderUserParameters deserObj;
         *  Deserialize(xml, out deserObj);
         *  this.Enabled = deserObj.Enabled;
         *  this.MethodSuffix = deserObj.MethodSuffix;
         *  this.UseDings = deserObj.UseDings;
         * }*/

        /// <summary>
        /// Determines whether this instance holds data for the specified builder type.
        /// </summary>
        /// <param name="builder">The requesting builder.</param>
        /// <returns>
        /// <c>true</c> if this instance holds data for the specified builder type; otherwise, <c>false</c>.
        /// </returns>
        public override bool HasDataForType(IMemberBuilder builder)
        {
            return(builder is PropertyBuilder);
        }
Esempio n. 15
0
 /// <summary>
 /// Determines whether this instance holds data for the specified builder type.
 /// </summary>
 /// <param name="builder">The requesting builder.</param>
 /// <returns>
 ///   <c>true</c> if this instance holds data for the specified builder type; otherwise, <c>false</c>.
 /// </returns>
 public virtual bool HasDataForType(IMemberBuilder builder)
 {
     return(false);
 }
 public AlienPropertyBuilder(IMember owner, IMemberBuilder parentBuilder, IProperty alienProperty)
     : base(parentBuilder, alienProperty)
 {
     _parentBuilder         = (IKeepSurrogateInstances)parentBuilder;
     _surrogatedTypeBuilder = _parentBuilder.Surrogates[owner];
 }
Esempio n. 17
0
 /// <summary>
 /// Determines whether this instance holds data for the specified builder type.
 /// </summary>
 /// <param name="builder">The requesting builder.</param>
 /// <returns>
 /// <c>true</c> if this instance holds data for the specified builder type; otherwise, <c>false</c>.
 /// </returns>
 public bool HasDataForType(IMemberBuilder builder)
 {
     return builder is PropertyBuilder;
 }
 public IPropertyBuilder CreateBuilder(IMemberBuilder parentBuilder)
 {
     return(new PropertyBuilder(parentBuilder, this));
 }
Esempio n. 19
0
 /// <summary>
 /// Determines whether this instance holds data for the specified builder type. Is always true. (see. Todo below)
 /// </summary>
 /// <param name="builder">The requesting builder.</param>
 /// <returns>
 ///   <c>true</c> if this instance holds data for the specified builder type; otherwise, <c>false</c>.
 /// </returns>
 public bool HasDataForType(IMemberBuilder builder)
 {
     // Todo: maybe request the builder for the use of this type of data.
     return(true);
 }
 public PropertyBuilder(IMemberBuilder parent, IProperty property)
     : base(parent, property)
 {
     Owner = parent;
 }