public void Constructor_Identifies_NestedPublicAccessCorrectly()
 {
     var internalStruct = new TypeWrapper(typeof(PublicStruct).Assembly.DefinedTypes.Single(x => x.Name == "NestedPublicStruct"));
     var SUT = new StructTypeData(internalStruct);
     Assert.That(SUT.AccessLevel == AccessLevelEnum.Public);
     Assert.That(SUT.Type == TypeEnum.Struct);
 }
Beispiel #2
0
        public TypeWrapper(Type type)
        {
            Type = type;
            FullName = type.FullName;
            Name = type.Name;
            Namespace = type.Namespace;
            IsClass = type.IsClass;
            IsInterface = type.IsInterface;
            IsEnum = type.IsEnum;
            IsValueType = type.IsValueType;
            IsNestedPrivate = type.IsNestedPrivate;
            IsVisible = type.IsVisible;
            IsPublic = type.IsPublic;
            IsNotPublic = type.IsNotPublic;
            IsNestedPublic = type.IsNestedPublic;
            IsNestedFamily = type.IsNestedFamily;
            IsNestedAssembly = type.IsNestedAssembly;
            IsSealed = type.IsSealed;
            IsAbstract = type.IsAbstract;
            AssemblyQualifiedName = type.AssemblyQualifiedName;

            if (type.BaseType != null)
            {
                BaseType = new TypeWrapper(type.BaseType);
            }
            _Interfaces = type.GetInterfaces().Select(x => new TypeWrapper(x)).ToArray();
        }
 public void Constructor_IdentifiesClass_NestedPrivateAccessCorrectly()
 {
     var internalClass = new TypeWrapper(typeof(PublicStruct).Assembly.DefinedTypes.Single(x => x.Name == "NestedPrivateEnum"));
     var SUT = new EnumTypeData(internalClass);
     Assert.That(SUT.AccessLevel == AccessLevelEnum.Private);
 }