示例#1
0
        protected VisualisableType(IContainer factory, Type type, VisualisableTypeData data, SubjectOrAssociate subjectOrAssociate)
        {
            if (type == null)
            {
                throw new ArgumentNullResourceException("type", Resources.General_Given_Parameter_Cannot_Be_Null);
            }

            this.doNotUseFactory = factory;
            this.NetType = type;
            this.PersistentDataField = data;
            this.SubjectOrAssociate = subjectOrAssociate;
            this.PersistentDataField.Modifiers = new ModifiersData(type);
            this.AssemblyName = type.Assembly.GetName().Name;
            this.AssemblyFullName = type.Assembly.FullName;
            this.AssemblyFileName = type.Assembly.Location;
            var genericNameHelper = new TypeDescriptorHelper(type);
            this.Id = genericNameHelper.GenerateId(); // It is not reliable to use type.GUID different generic parameters do not yeild different guids.
            this.Name = genericNameHelper.IsGeneric ? genericNameHelper.GenerateName() : type.Name;
            this.AssemblyQualifiedName = type.AssemblyQualifiedName ?? string.Format(CultureInfo.InvariantCulture, "{0}, {1}", type.Name, this.AssemblyFullName);
            this.ThisTypeNamespace = type.Namespace;
            if (type.IsEnum)
            {
                this.EnumMemberCount = Enum.GetNames(type).Length;
            }

            this.SetToolTip(type);
            this.SetAssociations(type);
            this.SetLinesOfCodeAndStaticAssociations(type);
        }
 public VisualisableTypeWithAssociationsDataAdaptor(
     IEnumerable<FieldAssociation> allAssociations, IEnumerable<ParentAssociation> thisTypeImplements, ParentAssociation parent, VisualisableTypeData persistentDataField)
 {
     this.parent = parent;
     this.persistentDataField = persistentDataField;
     this.thisTypeImplements = thisTypeImplements;
     this.allAssociations = allAssociations;
 }
示例#3
0
 protected VisualisableType(Type type, VisualisableTypeData data, SubjectOrAssociate subjectOrAssociate)
     : this(IoC.Default, type, data, subjectOrAssociate)
 {
 }
 public static void ClassInitialise(TestContext context)
 {
     visualisableType = new VisualisableType(typeof(Car));
     var accessor = VisualisableType_Accessor.AttachShadow(visualisableType);
     subject = accessor.ExtractPersistentData();
 }