Exemplo n.º 1
0
        public void WhenAddElementIsCalledUsingTwoDifferentTypesThenTwoElementTypesAreFound()
        {
            DsiElementModel model = new DsiElementModel();
            Assert.AreEqual(0, model.TotalElementCount);

            IDsiElement element1 = model.AddElement("name1", "type1", "source1");
            Assert.IsNotNull(element1);
            Assert.AreEqual(1, model.TotalElementCount);

            IDsiElement element2 = model.AddElement("name2", "type2", "source2");
            Assert.IsNotNull(element2);
            Assert.AreEqual(2, model.TotalElementCount);

            IDsiElement element3 = model.AddElement("name3", "type2", "source3");
            Assert.IsNotNull(element3);
            Assert.AreEqual(3, model.TotalElementCount);

            List<string> elementTypes = model.GetElementTypes().ToList();
            Assert.AreEqual(2, elementTypes.Count);
            Assert.AreEqual("type1", elementTypes[0]);
            Assert.AreEqual("type2", elementTypes[1]);

            Assert.AreEqual(1, model.GetElementTypeCount("type1"));
            Assert.AreEqual(2, model.GetElementTypeCount("type2"));
        }
Exemplo n.º 2
0
 private void AddTransitiveRelations(IDsiElement consumer)
 {
     foreach (IDsiElement provider in GetProviders(consumer))
     {
         FindTransitiveProviders(consumer, provider);
     }
 }
Exemplo n.º 3
0
 private void IncludeElement(IDsiElement element)
 {
     if (!ShouldElementBeIncluded(element))
     {
         _model.RemoveElement(element);
     }
 }
        private void FindRelations()
        {
            foreach (string consumerName in _allFoundElements)
            {
                _allFoundRelations[consumerName]      = new HashSet <string>();
                _oldModelFoundRelations[consumerName] = new HashSet <string>();
                _newModelFoundRelations[consumerName] = new HashSet <string>();

                foreach (IDsiRelation relation in _oldModel.GetRelations())
                {
                    IDsiElement consumer = _oldModel.FindElementById(relation.ConsumerId);
                    IDsiElement provider = _oldModel.FindElementById(relation.ProviderId);

                    if ((consumer != null) && (provider != null) && (consumer.Name == consumerName))
                    {
                        _oldModelFoundRelations[consumerName].Add(provider.Name);
                        _allFoundRelations[consumerName].Add(provider.Name);
                    }
                }

                foreach (IDsiRelation relation in _newModel.GetRelations())
                {
                    IDsiElement consumer = _oldModel.FindElementById(relation.ConsumerId);
                    IDsiElement provider = _oldModel.FindElementById(relation.ProviderId);

                    if ((consumer != null) && (provider != null) && (consumer.Name == consumerName))
                    {
                        _newModelFoundRelations[consumerName].Add(provider.Name);
                        _allFoundRelations[consumerName].Add(provider.Name);
                    }
                }
            }
        }
Exemplo n.º 5
0
 public void TestInitialize()
 {
     _elementsDataModel = new DsiElementModel();
     _a = _elementsDataModel.AddElement("a", "", "");
     _b = _elementsDataModel.AddElement("b", "", "");
     _c = _elementsDataModel.AddElement("c", "", "");
 }
Exemplo n.º 6
0
        public void GivenModelIsEmptyWhenAddElementIsCalledThenItsHasOneElement()
        {
            DsiElementModel model = new DsiElementModel();
            Assert.AreEqual(0, model.TotalElementCount);

            IDsiElement element = model.AddElement("name", "type", "source");
            Assert.IsNotNull(element);
            Assert.AreEqual(1, model.TotalElementCount);
        }
Exemplo n.º 7
0
        private ICollection <IDsiElement> GetProviders(IDsiElement consumer)
        {
            ICollection <IDsiElement> providers = new List <IDsiElement>();

            if (_directProviders.ContainsKey(consumer.Name))
            {
                providers = _directProviders[consumer.Name];
            }
            return(providers);
        }
Exemplo n.º 8
0
        public void GivenAnElementIsInTheModelWhenFindByIdIsCalledWithAnotherNameThenElementIsNotFound()
        {
            DsiElementModel model = new DsiElementModel();
            Assert.AreEqual(0, model.TotalElementCount);

            model.ImportElement(1, "name", "type", "source");

            IDsiElement foundElement = model.FindElementByName("unknown");
            Assert.IsNull(foundElement);
        }
Exemplo n.º 9
0
        public void AddTransitiveRelations()
        {
            DsiModel dataModel = new DsiModel("Test", Assembly.GetExecutingAssembly());

            IDsiElement element1 = dataModel.AddElement("element1Name", "class", "");

            Assert.IsNotNull(element1);
            IDsiElement element2 = dataModel.AddElement("element2Name", "class", "");

            Assert.IsNotNull(element2);
            IDsiElement element3 = dataModel.AddElement("element3Name", "class", "");

            Assert.IsNotNull(element3);
            IDsiElement element4 = dataModel.AddElement("element4Name", "class", "");

            Assert.IsNotNull(element4);
            IDsiElement element5 = dataModel.AddElement("element5Name", "class", "");

            Assert.IsNotNull(element5);

            dataModel.AddRelation(element1.Name, element2.Name, "", 1, "context");
            dataModel.AddRelation(element2.Name, element3.Name, "", 1, "context");
            dataModel.AddRelation(element3.Name, element4.Name, "", 1, "context");
            dataModel.AddRelation(element4.Name, element5.Name, "", 1, "context");

            Assert.AreEqual(1, dataModel.GetRelationsOfConsumer(element1.Id).Count);
            Assert.IsTrue(dataModel.DoesRelationExist(element1.Id, element2.Id));
            Assert.AreEqual(1, dataModel.GetRelationsOfConsumer(element2.Id).Count);
            Assert.IsTrue(dataModel.DoesRelationExist(element2.Id, element3.Id));
            Assert.AreEqual(1, dataModel.GetRelationsOfConsumer(element3.Id).Count);
            Assert.IsTrue(dataModel.DoesRelationExist(element3.Id, element4.Id));
            Assert.AreEqual(1, dataModel.GetRelationsOfConsumer(element4.Id).Count);
            Assert.IsTrue(dataModel.DoesRelationExist(element4.Id, element5.Id));
            Assert.AreEqual(0, dataModel.GetRelationsOfConsumer(element5.Id).Count);

            AddTransitiveRelationsAction transformation = new AddTransitiveRelationsAction(dataModel, true, null);

            transformation.Execute();

            Assert.AreEqual(4, dataModel.GetRelationsOfConsumer(element1.Id).Count);
            Assert.IsTrue(dataModel.DoesRelationExist(element1.Id, element2.Id));
            Assert.IsTrue(dataModel.DoesRelationExist(element1.Id, element3.Id));
            Assert.IsTrue(dataModel.DoesRelationExist(element1.Id, element4.Id));
            Assert.IsTrue(dataModel.DoesRelationExist(element1.Id, element5.Id));
            Assert.AreEqual(3, dataModel.GetRelationsOfConsumer(element2.Id).Count);
            Assert.IsTrue(dataModel.DoesRelationExist(element2.Id, element3.Id));
            Assert.IsTrue(dataModel.DoesRelationExist(element2.Id, element4.Id));
            Assert.IsTrue(dataModel.DoesRelationExist(element2.Id, element5.Id));
            Assert.AreEqual(2, dataModel.GetRelationsOfConsumer(element3.Id).Count);
            Assert.IsTrue(dataModel.DoesRelationExist(element3.Id, element4.Id));
            Assert.IsTrue(dataModel.DoesRelationExist(element3.Id, element5.Id));
            Assert.AreEqual(1, dataModel.GetRelationsOfConsumer(element4.Id).Count);
            Assert.IsTrue(dataModel.DoesRelationExist(element4.Id, element5.Id));
            Assert.AreEqual(0, dataModel.GetRelationsOfConsumer(element5.Id).Count);
        }
Exemplo n.º 10
0
        private void RegisterRelation(IDsiElement consumer, IDsiElement provider)
        {
            if (consumer != null && provider != null)
            {
                string type = "transitive";
                _model.AddRelation(consumer.Name, provider.Name, type, 1, "transformer");

                string description = "consumer=" + consumer.Name + " provider=" + provider.Name;
                AnalyzerLogger.LogTransformation(ActionName, description);
            }
        }
Exemplo n.º 11
0
        public void RemoveElement(IDsiElement element)
        {
            Logger.LogDataModelMessage($"Remove element id={element.Id} name={element.Name} type={element.Type} source={element.Source}");

            string key = element.Name.ToLower();

            _elementsByName.Remove(key);
            _elementsById.Remove(element.Id);

            ElementRemoved?.Invoke(this, element.Id);
        }
Exemplo n.º 12
0
        private void WriteElement(XmlWriter writer, IDsiElement element, IProgress <ProgressInfo> progress)
        {
            writer.WriteStartElement(ElementXmlNode);
            writer.WriteAttributeString(ElementIdXmlAttribute, element.Id.ToString());
            writer.WriteAttributeString(ElementNameXmlAttribute, element.Name);
            writer.WriteAttributeString(ElementTypeXmlAttribute, element.Type);
            writer.WriteAttributeString(ElementSourceXmlAttribute, element.Source);
            writer.WriteEndElement();

            _progressedElementCount++;
            UpdateProgress(progress);
        }
Exemplo n.º 13
0
        public void GivenAnElementIsInTheModelWhenAddElementIsCalledForAnotherElementThenItHasTwoElement()
        {
            DsiElementModel model = new DsiElementModel();
            Assert.AreEqual(0, model.TotalElementCount);

            IDsiElement element1 = model.AddElement("name1", "type", "source");
            Assert.IsNotNull(element1);
            Assert.AreEqual(1, model.TotalElementCount);

            IDsiElement element2 = model.AddElement("name2", "type", "source");
            Assert.IsNotNull(element2);
            Assert.AreEqual(2, model.TotalElementCount);
        }
Exemplo n.º 14
0
        public void GivenAnElementIsInTheModelWhenAddElementIsCalledAgainForThatElementThenItStillHasOneElement()
        {
            DsiElementModel model = new DsiElementModel();
            Assert.AreEqual(0, model.TotalElementCount);

            IDsiElement element1 = model.AddElement("name", "type", "source");
            Assert.IsNotNull(element1);
            Assert.AreEqual(1, model.TotalElementCount);

            IDsiElement element2 = model.AddElement("name", "type", "source");
            Assert.IsNull(element2);
            Assert.AreEqual(1, model.TotalElementCount);
        }
Exemplo n.º 15
0
        public void LoadingAndSavedModelRestoresThePreviousState()
        {
            string filename = "temp.dsi";

            DsiModel dataModel1 = new DsiModel("Test", Assembly.GetExecutingAssembly());

            IDsiElement consumer = dataModel1.AddElement("consumerName", "class", "consumerSource");

            Assert.IsNotNull(consumer);
            IDsiElement provider1 = dataModel1.AddElement("provider1Name", "class", "provider1Source");

            Assert.IsNotNull(provider1);
            IDsiElement provider2 = dataModel1.AddElement("provider2Name", "class", "provider2Source");

            Assert.IsNotNull(provider2);

            dataModel1.AddRelation(consumer.Name, provider1.Name, "relationType2", 2, "context");
            dataModel1.AddRelation(consumer.Name, provider2.Name, "relationType3", 3, "context");

            dataModel1.Save(filename, false, null);

            DsiModel dataModel2 = new DsiModel("Test", Assembly.GetExecutingAssembly());

            dataModel2.Load(filename, null);

            Assert.AreEqual(dataModel1.TotalElementCount, dataModel2.TotalElementCount);
            List <IDsiElement> dataModel1Elements = dataModel1.GetElements().ToList();
            List <IDsiElement> dataModel2Elements = dataModel2.GetElements().ToList();

            for (int elementIndex = 0; elementIndex < dataModel1.TotalElementCount; elementIndex++)
            {
                Assert.AreEqual(dataModel1Elements[elementIndex].Id, dataModel2Elements[elementIndex].Id);
                Assert.AreEqual(dataModel1Elements[elementIndex].Name, dataModel2Elements[elementIndex].Name);
                Assert.AreEqual(dataModel1Elements[elementIndex].Type, dataModel2Elements[elementIndex].Type);
                Assert.AreEqual(dataModel1Elements[elementIndex].Source, dataModel2Elements[elementIndex].Source);
                Assert.AreEqual(dataModel1.GetRelationsOfConsumer(dataModel1Elements[elementIndex].Id).Count, dataModel2.GetRelationsOfConsumer(dataModel1Elements[elementIndex].Id).Count);

                List <IDsiRelation> dataModel1Relations = dataModel1.GetRelationsOfConsumer(dataModel1Elements[elementIndex].Id).ToList();
                List <IDsiRelation> dataModel2Relations = dataModel2.GetRelationsOfConsumer(dataModel2Elements[elementIndex].Id).ToList();

                for (int relationIndex = 0; relationIndex < dataModel1.GetRelationsOfConsumer(dataModel1Elements[elementIndex].Id).Count;
                     relationIndex++)
                {
                    Assert.AreEqual(dataModel1Relations[relationIndex].ConsumerId, dataModel2Relations[relationIndex].ConsumerId);
                    Assert.AreEqual(dataModel1Relations[relationIndex].ProviderId, dataModel2Relations[relationIndex].ProviderId);
                    Assert.AreEqual(dataModel1Relations[relationIndex].Type, dataModel2Relations[relationIndex].Type);
                    Assert.AreEqual(dataModel1Relations[relationIndex].Weight, dataModel2Relations[relationIndex].Weight);
                }
            }
        }
Exemplo n.º 16
0
        public void GivenAnElementIsInTheModelWhenRemoveElementIsCalledThenElementIsNotFoundAnymoreByItName()
        {
            DsiElementModel model = new DsiElementModel();
            Assert.AreEqual(0, model.TotalElementCount);

            model.ImportElement(1, "name", "type", "source");
            IDsiElement foundElementBefore = model.FindElementByName("name");
            Assert.IsNotNull(foundElementBefore);

            model.RemoveElement(foundElementBefore);

            IDsiElement foundElementAfter = model.FindElementByName("name");
            Assert.IsNull(foundElementAfter);
        }
Exemplo n.º 17
0
        public void GivenAnElementIsInTheModelWhenFindByIdIsCalledItsIdThenElementIsFound()
        {
            DsiElementModel model = new DsiElementModel();
            Assert.AreEqual(0, model.TotalElementCount);

            model.ImportElement(1, "name", "type", "source");

            IDsiElement foundElement = model.FindElementById(1);
            Assert.IsNotNull(foundElement);
            Assert.AreEqual(1, foundElement.Id);
            Assert.AreEqual("name", foundElement.Name);
            Assert.AreEqual("type", foundElement.Type);
            Assert.AreEqual("source", foundElement.Source);
        }
Exemplo n.º 18
0
        public void RenameElement(IDsiElement element, string newName)
        {
            Logger.LogDataModelMessage("Rename element id={element.Id} from {element.Name} to {newName}");

            DsiElement e = element as DsiElement;

            if (e != null)
            {
                string oldKey = CreateKey(e.Name);
                _elementsByName.Remove(oldKey);
                e.Name = newName;
                string newKey = CreateKey(e.Name);
                _elementsByName[newKey] = e;
            }
        }
Exemplo n.º 19
0
        private bool ShouldElementBeIncluded(IDsiElement element)
        {
            bool include = false;

            foreach (string name in _names)
            {
                Regex regex = new Regex(name);
                Match match = regex.Match(element.Name);
                if (match.Success)
                {
                    include = true;
                }
            }
            return(include);
        }
Exemplo n.º 20
0
        private void FindDirectProviders()
        {
            foreach (IDsiElement element in _model.GetElements())
            {
                string key = element.Name;

                _directProviders[key] = new HashSet <IDsiElement>();

                foreach (IDsiRelation providerRelation in _model.GetRelationsOfConsumer(element.Id))
                {
                    IDsiElement provider = _model.FindElementById(providerRelation.ProviderId);
                    _directProviders[key].Add(provider);
                }
            }
        }
Exemplo n.º 21
0
        private void MoveElement(IDsiElement element)
        {
            foreach (MoveElementRule rule in _transformationRules)
            {
                if (element.Name.Contains(rule.From))
                {
                    string elementName    = element.Name;
                    string newElementName = element.Name.ReplaceIgnoreCase(rule.From, rule.To);

                    _model.RenameElement(element, newElementName);

                    string description = elementName + "->" + newElementName;
                    AnalyzerLogger.LogTransformation(ActionName, description);
                }
            }
        }
Exemplo n.º 22
0
        private void Move(IDsiElement element, string identifier)
        {
            string from = "." + identifier + ".";
            string to   = ".";

            if (element.Name.Contains(from))
            {
                string elementName    = element.Name;
                string newElementName = identifier + "." + element.Name.ReplaceIgnoreCase(from, to);

                _model.RenameElement(element, newElementName);

                string description = elementName + "->" + newElementName;
                AnalyzerLogger.LogTransformation(ActionName, description);
            }
        }
Exemplo n.º 23
0
        public void WhenRenameElementIsCalledThenItCanBeFoundUnderThatName()
        {
            DsiElementModel model = new DsiElementModel();
            Assert.AreEqual(0, model.TotalElementCount);

            IDsiElement element = model.AddElement("name", "type", "source");
            Assert.IsNotNull(element);
            Assert.AreEqual(1, model.TotalElementCount);

            model.RenameElement(element, "newname");
            Assert.AreEqual(1, model.TotalElementCount);

            IDsiElement foundElement = model.FindElementByName("newname");
            Assert.IsNotNull(foundElement);
            Assert.AreEqual(1, foundElement.Id);
            Assert.AreEqual("newname", foundElement.Name);
            Assert.AreEqual("type", foundElement.Type);
            Assert.AreEqual("source", foundElement.Source);
        }
Exemplo n.º 24
0
        private void FindTransitiveProviders(IDsiElement consumer, IDsiElement currentProvider)
        {
            foreach (IDsiElement transitiveProvider in GetProviders(currentProvider))
            {
                string key = consumer.Name;
                if (!_transitiveProviders.ContainsKey(consumer.Name))
                {
                    _transitiveProviders[key] = new HashSet <IDsiElement>();
                }

                if (!_transitiveProviders[key].Contains(transitiveProvider))
                {
                    _transitiveProviders[key].Add(transitiveProvider);
                    RegisterRelation(consumer, transitiveProvider);

                    FindTransitiveProviders(consumer, transitiveProvider);
                }
            }
        }
Exemplo n.º 25
0
        public IDsiRelation ImportRelation(int consumerId, int providerId, string type, int weight)
        {
            Logger.LogDataModelMessage("Import relation consumerId={consumerId} providerId={providerId} type={type} weight={weight}");

            _relationCount++;

            DsiRelation relation = null;

            IDsiElement consumer = _elementsDataModel.FindElementById(consumerId);
            IDsiElement provider = _elementsDataModel.FindElementById(providerId);

            if ((consumer != null) && (provider != null))
            {
                relation = AddOrUpdateRelation(consumer.Id, provider.Id, type, weight);
            }
            else
            {
                AnalyzerLogger.LogDataModelRelationNotResolved(consumerId.ToString(), providerId.ToString());
            }
            return(relation);
        }
Exemplo n.º 26
0
        public void DoNotMergeWhenImplementationDependsOnHeaderFileWithOtherName()
        {
            DsiModel dataModel = new DsiModel("Test", Assembly.GetExecutingAssembly());

            IDsiElement elementCpp = dataModel.AddElement("namespace1.namespace1.element1Name.cpp", "class", "");
            IDsiElement elementH   = dataModel.AddElement("namespace3.namespace4.ELEMENT1NAME.h", "class", "");

            dataModel.AddRelation(elementCpp.Name, elementH.Name, "", 1, "context");

            Assert.IsNotNull(dataModel.FindElementByName("namespace1.namespace1.element1Name.cpp"));
            Assert.IsNotNull(dataModel.FindElementByName("namespace3.namespace4.ELEMENT1NAME.h"));
            Assert.IsNull(dataModel.FindElementByName("namespace1.namespace1.element1Name.h"));

            MoveHeaderElementsAction transformation = new MoveHeaderElementsAction(dataModel, true, null);

            transformation.Execute();

            Assert.IsNotNull(dataModel.FindElementByName("namespace1.namespace1.element1Name.cpp"));
            Assert.IsNotNull(dataModel.FindElementByName("namespace3.namespace4.ELEMENT1NAME.h"));
            Assert.IsNull(dataModel.FindElementByName("namespace1.namespace1.element1Name.h"));
        }
Exemplo n.º 27
0
        private void ImportDsiElement(IDsiElement dsiElement)
        {
            IDsmElement parent      = null;
            ElementName elementName = new ElementName();

            foreach (string name in new ElementName(dsiElement.Name).NameParts)
            {
                elementName.AddNamePart(name);

                bool   isElementLeaf = (dsiElement.Name == elementName.FullName);
                string elementType   = isElementLeaf ? dsiElement.Type : "";

                IDsmElement element = _importPolicy.ImportElement(elementName.FullName, name, elementType, parent);
                parent = element;

                if (isElementLeaf)
                {
                    _dsiToDsmMapping[dsiElement.Id] = element.Id;
                }
            }
        }
Exemplo n.º 28
0
        public void TestAnalyze()
        {
            AnalyzerSettings analyzerSettings = new AnalyzerSettings
            {
                LoggingEnabled = true,
                InputFilename  = "example.dot",
            };

            IDsiModel model = new DsiModel("Test", Assembly.GetExecutingAssembly());

            Jdeps.Analysis.Analyzer analyzer = new Jdeps.Analysis.Analyzer(model, analyzerSettings, null);
            analyzer.Analyze();

            Assert.AreEqual(5, model.TotalElementCount);

            IDsiElement elementJavaxCryptoCipher = model.FindElementByName("javax.crypto.Cipher");

            Assert.IsNotNull(elementJavaxCryptoCipher);

            IDsiElement elementJavaxCryptoCipherTransform = model.FindElementByName("javax.crypto.Cipher.Transform");

            Assert.IsNotNull(elementJavaxCryptoCipherTransform);

            IDsiElement elementJavaxCryptoSpecRcsParameterSpec = model.FindElementByName("javax.crypto.spec.RC5ParameterSpec");

            Assert.IsNotNull(elementJavaxCryptoSpecRcsParameterSpec);

            IDsiElement elementSunSecurityJcaGetInstance = model.FindElementByName("sun.security.jca.GetInstance");

            Assert.IsNotNull(elementSunSecurityJcaGetInstance);

            IDsiElement elementJavaLangCharSequence = model.FindElementByName("java.lang.CharSequence");

            Assert.IsNotNull(elementJavaLangCharSequence);

            Assert.AreEqual(3, model.ResolvedRelationCount);
            Assert.IsTrue(model.DoesRelationExist(elementJavaxCryptoCipher.Id, elementJavaxCryptoSpecRcsParameterSpec.Id));
            Assert.IsTrue(model.DoesRelationExist(elementJavaxCryptoCipher.Id, elementSunSecurityJcaGetInstance.Id));
            Assert.IsTrue(model.DoesRelationExist(elementJavaxCryptoCipherTransform.Id, elementJavaLangCharSequence.Id));
        }
Exemplo n.º 29
0
        public IDsiRelation AddRelation(string consumerName, string providerName, string type, int weight, string context)
        {
            Logger.LogDataModelMessage("Add relation consumerName={consumerName} providerName={providerName} type={type} weight={weight}");

            DsiRelation relation = null;

            _relationCount++;

            IDsiElement consumer = _elementsDataModel.FindElementByName(consumerName);
            IDsiElement provider = _elementsDataModel.FindElementByName(providerName);

            if ((consumer != null) && (provider != null))
            {
                relation = AddOrUpdateRelation(consumer.Id, provider.Id, type, weight);
            }
            else
            {
                AnalyzerLogger.LogDataModelRelationNotResolved(consumerName, providerName);
            }

            return(relation);
        }
Exemplo n.º 30
0
        public void TestAnalyzePhysicalView()
        {
            AnalyzerSettings analyzerSettings = AnalyzerSettings.CreateDefault();

            analyzerSettings.ExternalIncludeDirectories.Clear();
            analyzerSettings.ViewMode      = ViewMode.PhysicalView;
            analyzerSettings.InputFilename = Path.Combine(TestData.SolutionDirectory, "DsmSuite.sln");
            analyzerSettings.ExternalIncludeDirectories.Add(new ExternalIncludeDirectory {
                Path = Path.Combine(TestData.TestDataDirectory, "DirExternal"), ResolveAs = "External"
            });
            analyzerSettings.InterfaceIncludeDirectories.Add(Path.Combine(TestData.TestDataDirectory, "DirInterfaces"));
            analyzerSettings.RootDirectory = TestData.SolutionDirectory;

            DsiModel dataModel = new DsiModel("Test", Assembly.GetExecutingAssembly());

            Analyzer.VisualStudio.Analysis.Analyzer analyzer = new Analyzer.VisualStudio.Analysis.Analyzer(dataModel, analyzerSettings, null);
            analyzer.Analyze();

            HashSet <string> elementNames = new HashSet <string>();
            Dictionary <string, HashSet <string> > providerNames = new Dictionary <string, HashSet <string> >();

            foreach (IDsiElement element in dataModel.GetElements())
            {
                elementNames.Add(element.Name);

                foreach (IDsiRelation relation in dataModel.GetRelationsOfConsumer(element.Id))
                {
                    if (!providerNames.ContainsKey(element.Name))
                    {
                        providerNames[element.Name] = new HashSet <string>();
                    }

                    IDsiElement provider = dataModel.FindElementById(relation.ProviderId);
                    providerNames[element.Name].Add(provider.Name);
                }
            }

            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA1.h"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA1.cpp"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA2.h"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA2.cpp"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA3.h"));

            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirB.ClassB1.h"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirB.ClassB1.cpp"));

            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirC.ClassC1.h"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirC.ClassC1.cpp"));

            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirD.ClassD1.h"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirD.ClassD1.cpp"));

            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirClones.Identical.ClassA1.cpp"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirClones.Identical.CopyClassA1.cpp"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirClones.NotIdentical.ClassA1.cpp"));

            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirIDL.IInterface1.idl"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.IdlOutput.IInterface1.h"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.IdlOutput.IInterface1_i.c"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.IdlOutput.MyTypeLibrary.tlb"));

            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirIDL.IInterface2.idl"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.IdlOutput.IInterface2.h"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.IdlOutput.IInterface2_i.c"));
            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.IdlOutput.DsmSuite.Analyzer.VisualStudio.Test.Data.tlb"));

            Assert.IsTrue(elementNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.targetver.h"));

            Assert.IsTrue(elementNames.Contains("External.External.h"));

            HashSet <string> classA2ProviderNames = providerNames["DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA2.cpp"];

            Assert.IsTrue(classA2ProviderNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA2.h"));
            Assert.IsTrue(classA2ProviderNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA1.h"));
            Assert.IsTrue(classA2ProviderNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirB.ClassB1.h"));
            Assert.IsTrue(classA2ProviderNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirC.ClassC1.h"));
            Assert.IsTrue(classA2ProviderNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirD.ClassD1.h"));

            Assert.IsTrue(classA2ProviderNames.Contains("External.External.h"));

            Assert.IsTrue(classA2ProviderNames.Contains("DsmSuite.Analyzer.VisualStudio.Test.Data.DirA.ClassA3.h"));
        }