Exemple #1
0
        public void ShouldVisitEachCodeClass()
        {
            var project = DTETransformer.BuildDteProject(new Type[]
            {
                typeof(M),
                typeof(N)
            }, projectName: "NamespaceTraverserTests");

            int         callCount     = 0;
            var         expectedNames = new string[] { "M", "N" };
            ProjectItem projectItem;

            if (TryGetSingle(project.ProjectItems.GetEnumerator(), out projectItem))
            {
                foreach (CodeNamespace ns in projectItem.FileCodeModel.CodeElements)
                {
                    Traversal.TraverseClassesInNamespace(ns, (c) => { Assert.AreEqual(expectedNames[callCount++], c.Name); });
                }
            }

            Assert.AreEqual(2, callCount);
        }