public ClassMemberDescriptor(ClassDescriptor descriptor, MemberInfo member) { var property = member as PropertyInfo; this.AccessModifier = AccessModifier.Public; if (property != null) { this.MemberType = property.PropertyType; } var field = member as FieldInfo; if (field != null) { this.MemberType = field.FieldType; } this.AccessModifier = AccessModifier.GetAccessModifier(member); if (this.MemberType == null) throw new NPlantException("Member's could not be interpretted as either a property or a field"); _descriptor = descriptor; this.Name = member.Name; this.Key = this.Name; _metaModel = ClassDiagramVisitorContext.Current.GetTypeMetaModel(this.MemberType); this.IsInherited = member.DeclaringType != descriptor.ReflectedType; }
public ClassMemberDescriptor(Type containingType, FieldInfo member, TypeMetaModel metaModel) { this.Name = member.Name; this.MemberType = member.FieldType; this.Key = this.Name; _metaModel = metaModel; this.IsInherited = member.DeclaringType != containingType; }
public void TypeMetaModel_Should_Be_Properly_Defaulted() { var model = new TypeMetaModel(typeof (Subject)); Assert.That(model.Hidden, Is.False); Assert.That(model.HideAsBaseClass, Is.False); Assert.That(model.IsComplexType, Is.True); Assert.That(model.IsPrimitive, Is.False); Assert.That(model.Name, Is.EqualTo("Subject")); Assert.That(model.Note.ToString(), Is.EqualTo(string.Empty)); Assert.That(model.TreatAllMembersAsPrimitives, Is.False); }
public TypeMetaModel this[Type type] { get { TypeMetaModel model; if (!_dictionary.TryGetValue(type, out model)) { model = new TypeMetaModel(type); _dictionary.Add(type, model); } return(model); } set { _dictionary[type] = value; } }
public TypeMetaModel this[Type type] { get { TypeMetaModel model; if (!_dictionary.TryGetValue(type, out model)) { model = new TypeMetaModel(type); _dictionary.Add(type, model); } return model; } set { _dictionary[type] = value; } }
public void Name_Formatting_Suite(Type type, string expectedName) { var model = new TypeMetaModel(type); Assert.That(model.Name, Is.EqualTo(expectedName)); }