Ejemplo n.º 1
0
 internal MethodTest()
 {
     Name        = "name";
     SavedHash   = 1;
     IsExtension = false;
     Parameters  = Enumerable.Empty <IParameterMetadata>();
     ReturnType  = new TypeTest("type");
 }
Ejemplo n.º 2
0
        public void CopyCtorTest()
        {
            TypeTest       tmp = new TypeTest();
            DbTypeMetadata sut = new DbTypeMetadata(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);
        }
Ejemplo n.º 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 };
            DbAssemblyMetadata sut = new DbAssemblyMetadata(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());
        }
Ejemplo n.º 4
0
 internal PropertyTest()
 {
     Name      = "name";
     SavedHash = 1;
     MyType    = new TypeTest("type");
 }
Ejemplo n.º 5
0
 internal ParameterTest()
 {
     Name      = "name";
     SavedHash = 1;
     MyType    = new TypeTest("type");
 }