コード例 #1
0
        public static AssemblyMetadata MapToDeserialize(AssemblyMetadataBase metadata)
        {
            AssemblyMetadata assemblyModel = new AssemblyMetadata();
            Type             type          = metadata.GetType();

            assemblyModel.Name = metadata.Name;
            PropertyInfo namespaceMetadatasProperty = type.GetProperty("Namespaces", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
            List <NamespaceMetadataBase> namespaces = (List <NamespaceMetadataBase>)ConvertionUtilities.ConvertList(typeof(NamespaceMetadataBase), (IList)namespaceMetadatasProperty?.GetValue(metadata));

            if (namespaces != null)
            {
                assemblyModel.Namespaces = namespaces.Select(n => new NamespaceMetadataMapper().MapToDeserialize(n)).ToList();
            }
            return(assemblyModel);
        }
コード例 #2
0
        public static void Initialize(TestContext testContext)
        {
            string   _DBRelativePath       = @"DatabaseForTests\TestDatabase.mdf";
            string   _TestingWorkingFolder = Environment.CurrentDirectory;
            string   _DBPath       = Path.Combine(_TestingWorkingFolder, _DBRelativePath);
            FileInfo _databaseFile = new FileInfo(_DBPath);

            Assert.IsTrue(_databaseFile.Exists, $"{Environment.CurrentDirectory}");
            databasePath = $@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename={_DBPath};Integrated Security = True; Connect Timeout = 30;";

            dllPath              = "./../../../DllForTests/TPA.ApplicationArchitecture.dll";
            serializer           = new DatabaseSerializer();
            assemblyMetadataBase = new AssemblyMetadataDB();

            reflector = new Reflector(dllPath);
            serializer.Serialize(AssemblyMetadataMapper.MapToSerialize(reflector.AssemblyMetadata, assemblyMetadataBase.GetType()), databasePath);
            assemblyMetadata = AssemblyMetadataMapper.MapToDeserialize(serializer.Deserialize(databasePath));
        }
コード例 #3
0
        public static void Initialize(TestContext testContext)
        {
            dllPath              = "./../../../DllForTests/TPA.ApplicationArchitecture.dll";
            pathTarget           = "./../../../UnitTestXmlSerializing/bin/Debug/xmlTest.xml";
            serializer           = new XMLSerializer();
            assemblyMetadataBase = new AssemblyMetadataXml();

            reflector = new Reflector(dllPath);
            serializer.Serialize(AssemblyMetadataMapper.MapToSerialize(reflector.AssemblyMetadata, assemblyMetadataBase.GetType()), pathTarget);
            assemblyMetadata = AssemblyMetadataMapper.MapToDeserialize(serializer.Deserialize(pathTarget));
        }