void AddTestClass(TopLevelTypeName fullName, ITest test)
        {
            topLevelTestClasses.Add(fullName, test);
            TestCollection testNamespace = FindOrCreateNamespace(NestedTestCollection, project.RootNamespace, fullName.Namespace);

            testNamespace.Add(test);
        }
        TestCollection FindOrCreateNamespace(TestCollection collection, string parentNamespace, string @namespace)
        {
            if (parentNamespace == @namespace)
            {
                return(collection);
            }
            foreach (var node in collection.OfType <TestNamespace>())
            {
                if (@namespace == node.NamespaceName)
                {
                    return(node.NestedTests);
                }
                if (@namespace.StartsWith(node.NamespaceName + ".", StringComparison.Ordinal))
                {
                    return(FindOrCreateNamespace(node.NestedTests, node.NamespaceName, @namespace));
                }
            }
            // Create missing namespace node:

            // Figure out which part of the namespace we can remove due to the parent namespace:
            int startPos = 0;

            if (@namespace.StartsWith(parentNamespace + ".", StringComparison.Ordinal))
            {
                startPos = parentNamespace.Length + 1;
            }
            // Get the next dot
            int dotPos = @namespace.IndexOf('.', startPos);

            if (dotPos < 0)
            {
                var newNode = new TestNamespace(this, @namespace);
                collection.Add(newNode);
                return(newNode.NestedTests);
            }
            else
            {
                var newNode = new TestNamespace(this, @namespace.Substring(0, dotPos));
                collection.Add(newNode);
                return(FindOrCreateNamespace(newNode.NestedTests, newNode.NamespaceName, @namespace));
            }
        }