Exemplo n.º 1
0
        public void CopyCtorTest()
        {
            AssemblyMetadata   tmpass = new AssemblyMetadata(Assembly.GetExecutingAssembly());
            INamespaceMetadata tmp    = tmpass.Namespaces.First();
            NamespaceMetadata  sut    = new NamespaceMetadata(tmp);

            Assert.IsTrue(tmp.Name.Equals(sut.Name));
            Assert.AreEqual(tmp.SavedHash, sut.SavedHash);
            Assert.AreEqual(tmp.Types.Count(), sut.Types.Count());
        }
Exemplo n.º 2
0
        public SerializationNamespaceMetadata(INamespaceMetadata namespaceMetadata)
        {
            Name      = namespaceMetadata.Name;
            SavedHash = namespaceMetadata.SavedHash;
            List <ITypeMetadata> types = new List <ITypeMetadata>();

            foreach (ITypeMetadata child in namespaceMetadata.Types)
            {
                if (AlreadyMapped.TryGetValue(child.SavedHash, out IMetadata item))
                {
                    types.Add(item as ITypeMetadata);
                }
                else
                {
                    ITypeMetadata newType = new SerializationTypeMetadata(child);
                    types.Add(newType);
                    AlreadyMapped.Add(newType.SavedHash, newType);
                }
            }

            Types = types;
        }