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); }
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); }
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); }
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); }
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); }
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); }