示例#1
0
        public void CheckAmountOfNamespaces()
        {
            Reflector          reflector        = new Reflector(reflectorPath);
            DatabaseSerializer xmlSerialization = new DatabaseSerializer();

            xmlSerialization.Save(AssemblyModelMapper.MapDown(reflector.AssemblyModel, assemblyModel.GetType()), null);
            AssemblyModel model = AssemblyModelMapper.MapUp(xmlSerialization.Read(null));

            Assert.AreEqual(3, model.NamespaceModels.Count);
        }
示例#2
0
        public void CheckAmountOfFieldsInClass()
        {
            Reflector          reflector        = new Reflector(reflectorPath);
            DatabaseSerializer xmlSerialization = new DatabaseSerializer();

            xmlSerialization.Save(AssemblyModelMapper.MapDown(reflector.AssemblyModel, assemblyModel.GetType()), null);
            AssemblyModel model = AssemblyModelMapper.MapUp(xmlSerialization.Read(null));

            List <TypeModel> classes = model.NamespaceModels
                                       .Find(t => t.Name == "TestLibrary").Types.Where(t => t.Name == "PublicClass").ToList();

            Assert.AreEqual(2, classes.First().Fields.Count);
        }
示例#3
0
        public void CheckAmountOfInterfaces()
        {
            Reflector          reflector        = new Reflector(reflectorPath);
            DatabaseSerializer xmlSerialization = new DatabaseSerializer();

            xmlSerialization.Save(AssemblyModelMapper.MapDown(reflector.AssemblyModel, assemblyModel.GetType()), null);
            AssemblyModel model = AssemblyModelMapper.MapUp(xmlSerialization.Read(null));

            List <TypeModel> interfaces = model.NamespaceModels
                                          .Find(t => t.Name == "TestLibrary").Types.Where(t => t.Type == TypeEnum.Interface).ToList();

            Assert.AreEqual(1, interfaces.Count);
        }
示例#4
0
        public void CheckAmountOfClassesWithGenericArguments()
        {
            Reflector          reflector        = new Reflector(reflectorPath);
            DatabaseSerializer xmlSerialization = new DatabaseSerializer();

            xmlSerialization.Save(AssemblyModelMapper.MapDown(reflector.AssemblyModel, assemblyModel.GetType()), null);
            AssemblyModel model = AssemblyModelMapper.MapUp(xmlSerialization.Read(null));

            List <TypeModel> genericClasses = model.NamespaceModels
                                              .Find(t => t.Name == "TestLibrary.NamespaceTwo").Types.Where(t => t.GenericArguments?.Count > 0)
                                              .ToList();

            Assert.AreEqual(1, genericClasses.Count);
        }
示例#5
0
        public void CheckAmountOfAbstractClasses()
        {
            Reflector          reflector        = new Reflector(reflectorPath);
            DatabaseSerializer xmlSerialization = new DatabaseSerializer();

            xmlSerialization.Save(AssemblyModelMapper.MapDown(reflector.AssemblyModel, assemblyModel.GetType()), null);
            AssemblyModel model = AssemblyModelMapper.MapUp(xmlSerialization.Read(null));

            List <TypeModel> abstractClasses = model.NamespaceModels
                                               .Find(t => t.Name == "TestLibrary").Types
                                               .Where(t => t.Modifiers.AbstractEnum == AbstractEnum.Abstract).ToList();

            Assert.AreEqual(2, abstractClasses.Count);
        }
示例#6
0
        public void CheckAmountOfClasses()
        {
            Reflector          reflector        = new Reflector(reflectorPath);
            DatabaseSerializer xmlSerialization = new DatabaseSerializer();

            xmlSerialization.Save(AssemblyModelMapper.MapDown(reflector.AssemblyModel, assemblyModel.GetType()), null);
            AssemblyModel model = AssemblyModelMapper.MapUp(xmlSerialization.Read(null));

            List <TypeModel> testLibraryTypes =
                model.NamespaceModels.Find(t => t.Name == "TestLibrary").Types;
            List <TypeModel> namespaceTwoTypes           = model.NamespaceModels.Find(t => t.Name == "TestLibrary.NamespaceTwo").Types;
            List <TypeModel> namespaceWithRecursionTypes =
                model.NamespaceModels.Find(t => t.Name == "TestLibrary.NamespaceWithRecursion").Types;

            Assert.AreEqual(6, namespaceTwoTypes.Count);
            Assert.AreEqual(3, namespaceWithRecursionTypes.Count);
            Assert.AreEqual(4, testLibraryTypes.Count);
        }