public NUnitTestDiscoveryService(Assembly assembly)
        {
            if (assembly == null)
            throw new ArgumentNullException("assembly");
              var fixtureTypes = new List<Type>();
              var setupTypes = new List<Type>();

              // ExportedTypes include all public types, including nested
              foreach (var type in assembly.ExportedTypes)
            IntrospectType(type, fixtureTypes, setupTypes);

              var setupNodes = IntrospectSetupNodes(setupTypes);

              IntrospectionNode globalNode = null;
              foreach (var fixtureType in fixtureTypes)
              {
            var node = FindNode(setupNodes, fixtureType);
            if (node == null)
            {
              if (globalNode == null)
            globalNode = new IntrospectionNode();
              globalNode.Fixtures.Add(fixtureType);
            } else
              node.Fixtures.Add(fixtureType);
              }

              if (globalNode != null)
            myNodes.Add(globalNode);
              foreach (var setupNode in setupNodes)
            myNodes.Add(setupNode);
        }
        public NUnitTestDiscoveryService(Type fixtureType)
        {
            if (fixtureType == null)
            throw new ArgumentNullException("fixtureType");
              if (fixtureType.IsGenericTypeDefinition)
            throw new TestCompositionException("Cannot produce tests from open generic type");
              if (fixtureType.IsAbstract)
            throw new TestCompositionException("Cannot produce tests from abstract type");

              var node = new IntrospectionNode();
              node.Fixtures.Add(fixtureType);
              myNodes.Add(node);
        }
        private static IEnumerable<ITestDescriptor> CreateDescriptor(IntrospectionNode node)
        {
            if (node.SetupFixture != null)
              {
            var setupDescriptor = CreateFixtureSetup(node.SetupFixture);
            foreach (var fixtureType in node.Fixtures)
              setupDescriptor.AddChild(CreateFixture(fixtureType));

            foreach (var childNode in node.Children)
              foreach (var childDescriptor in CreateDescriptor(childNode))
            setupDescriptor.AddChild(childDescriptor);

            yield return setupDescriptor;
              } else
              {
            foreach (var fixtureType in node.Fixtures)
              yield return CreateFixture(fixtureType);
              }
        }