コード例 #1
0
 internal MethodTest()
 {
     Name        = "name";
     SavedHash   = 1;
     IsExtension = false;
     Parameters  = Enumerable.Empty <IParameterMetadata>();
     ReturnType  = new TypeTest("type");
 }
コード例 #2
0
        public void CopyCtorTest()
        {
            TypeTest tmp = new TypeTest();
            SerializationTypeMetadata sut = new SerializationTypeMetadata(tmp);

            Assert.IsTrue(tmp.Name.Equals(sut.Name));
            Assert.AreEqual(tmp.SavedHash, sut.SavedHash);
            Assert.AreEqual(tmp.ImplementedInterfaces.Count(), sut.ImplementedInterfaces.Count());
            Assert.AreEqual(tmp.Properties.Count(), sut.Properties.Count());
            Assert.IsNull(sut.GenericArguments);
            Assert.IsNull(sut.Modifiers);
            Assert.AreEqual(tmp.NamespaceName, sut.NamespaceName);
        }
コード例 #3
0
        public void DeepMappingTest()
        {
            AssemblyTest assemblyMetadata = new AssemblyTest {
                Name = "test0", SavedHash = 0
            };
            NamespaceTest namespaceMeta1 = new NamespaceTest {
                Name = "test1", SavedHash = 1
            };
            NamespaceTest namespaceMeta2 = new NamespaceTest {
                Name = "test2", SavedHash = 2
            };
            TypeTest type1 = new TypeTest {
                Name = "Type1", SavedHash = 3
            };

            type1.Properties = new[] { new PropertyTest {
                                           Name = "prop", MyType = type1, SavedHash = 4
                                       } };
            type1.Attributes = new[] { new AttributeTest {
                                           Name = "attr", SavedHash = 5
                                       } };
            MethodTest method1 = new MethodTest
            {
                Name       = "method1",
                SavedHash  = 6,
                Parameters = new[] { new ParameterTest {
                                         Name = "param1", MyType = type1, SavedHash = 7
                                     } }
            };

            type1.Methods               = new[] { method1 };
            namespaceMeta1.Types        = new[] { type1 };
            assemblyMetadata.Namespaces = new[] { namespaceMeta1, namespaceMeta2 };
            SerializationAssemblyMetadata sut = new SerializationAssemblyMetadata(assemblyMetadata);

            Assert.AreEqual(2, sut.Namespaces.Count());
            Assert.AreEqual(1, sut.Namespaces.First().Types.Count());
            Assert.AreEqual(1, sut.Namespaces.First().Types.First().Methods.Count());
            Assert.AreEqual(1, sut.Namespaces.First().Types.First().Properties.Count());
            Assert.AreEqual(1, sut.Namespaces.First().Types.First().Attributes.Count());
            Assert.AreEqual(1, sut.Namespaces.First().Types.First().Methods.First().Parameters.Count());
        }
コード例 #4
0
 internal ParameterTest()
 {
     Name      = "name";
     SavedHash = 1;
     MyType    = new TypeTest("type");
 }
コード例 #5
0
 internal PropertyTest()
 {
     Name      = "name";
     SavedHash = 1;
     MyType    = new TypeTest("type");
 }