示例#1
0
        public void Initialization()
        {
            var declaringType = MutableTypeObjectMother.Create(name: "DeclaringType");
            var baseType      = ReflectionObjectMother.GetSomeSubclassableType();
            var name          = "MyType";
            var @namespace    = "MyNs";
            var attributes    = (TypeAttributes)7;

            var mutableType = new MutableType(
                declaringType, baseType, name, @namespace, attributes, _interfaceMappingComputerMock, _mutableMemberFactoryMock);

            Assert.That(mutableType.DeclaringType, Is.SameAs(declaringType));
            Assert.That(mutableType.MutableDeclaringType, Is.SameAs(declaringType));
            Assert.That(mutableType.BaseType, Is.SameAs(baseType));
            Assert.That(mutableType.Name, Is.EqualTo(name));
            Assert.That(mutableType.Namespace, Is.EqualTo(@namespace));
            Assert.That(mutableType.FullName, Is.EqualTo("MyNs.DeclaringType+MyType"));
            Assert.That(mutableType.Attributes, Is.EqualTo(attributes));
            Assert.That(mutableType.IsGenericType, Is.False);
            Assert.That(mutableType.IsGenericTypeDefinition, Is.False);
            Assert.That(mutableType.GetGenericArguments(), Is.Empty);

            Assert.That(mutableType.AddedNestedTypes, Is.Empty);
            Assert.That(mutableType.AddedCustomAttributes, Is.Empty);
            Assert.That(mutableType.Initialization, Is.Not.Null);
            Assert.That(mutableType.AddedInterfaces, Is.Empty);
            Assert.That(mutableType.AddedFields, Is.Empty);
            Assert.That(mutableType.AddedConstructors, Is.Empty);
            Assert.That(mutableType.AddedMethods, Is.Empty);
            Assert.That(mutableType.AddedProperties, Is.Empty);
            Assert.That(mutableType.AddedEvents, Is.Empty);
        }