public TestAssembly Parse(Assembly assembly)
        {
            IList<Type> types = new List<Type>();
            foreach (Type type in assembly.ExportedTypes)
            {
                if (type.CustomAttributes.Any(x => x.AttributeType.Name == "TestClassAttribute"))
                {
                    types.Add(type);
                }
            }

            TestAssembly item = new TestAssembly();
            item.Name = assembly.Location;
            item.Fixtures = new List<TestFixture>();
            foreach (Type type in types)
            {
                if (Args.PLevel == PLevel.TestClass)
                {
                    TestFixture fixture = new TestFixture();
                    fixture.Name = type.FullName;
                    SetGroupAndExclusiveParams(type, fixture);

                    item.Fixtures.Add(fixture);
                }
                else if (Args.PLevel == PLevel.TestMethod)
                {
                    TestFixture testClassFixture = new TestFixture();
                    SetGroupAndExclusiveParams(type, testClassFixture);

                    foreach (MemberInfo memberInfo in type.GetMethods().Where(x => x.CustomAttributes.Any(y => y.AttributeType.Name == "TestMethodAttribute")))
                    {
                        TestFixture fixture = new TestFixture();
                        fixture.Name = type.FullName + "." + memberInfo.Name;
                        SetGroupAndExclusiveParams(memberInfo, fixture);

                        if (string.IsNullOrEmpty(testClassFixture.Group) == false)
                        {
                            fixture.Group = testClassFixture.Group;
                        }

                        if (testClassFixture.Exclusive != null)
                        {
                            fixture.Exclusive = testClassFixture.Exclusive;
                        }

                        item.Fixtures.Add(fixture);
                    }
                }
            }

            return item;
        }
        public void Parse_NoBrake()
        {
            IList<string> assemblyList = new[] { "abc.dll", "abb.dll" };
            Assembly assemblyAbc = Assembly.GetAssembly(typeof(int));
            Assembly assemblyAbb = Assembly.GetAssembly(typeof(ContainerBuilder));
            TestAssembly testAssemblyAbc = new TestAssembly();
            TestAssembly testAssemblyAbb = new TestAssembly();
            IList<RunData> itemsAbc = Stub<IList<RunData>>();
            IList<RunData> itemsAbb = Stub<IList<RunData>>();
            using (Ordered())
            {
                breaker.Expect((m) => m.IsBreakReceived()).Return(false);
                args.Expect(m => m.AssemblyList).Return(assemblyList);

                windowsFileHelper.Expect((m) => m.GetAssembly(assemblyList[0])).Return(assemblyAbc);
                parser.Expect((m) => m.Parse(assemblyAbc)).Return(testAssemblyAbc);
                runDataBuilder.Expect(m => m.Create(testAssemblyAbc)).Return(itemsAbc);
                runDataListBuilder.Expect(m => m.Add(itemsAbc));

                windowsFileHelper.Expect((m) => m.GetAssembly(assemblyList[1])).Return(assemblyAbb);
                parser.Expect((m) => m.Parse(assemblyAbb)).Return(testAssemblyAbb);
                runDataBuilder.Expect(m => m.Create(testAssemblyAbb)).Return(itemsAbb);
                runDataListBuilder.Expect(m => m.Add(itemsAbb));
            }

            VerifyTarget(() => target.Parse());
        }
 public void SetUp()
 {
     args = Stub<ITestRunnerArgs>();
     target = new RunDataBlockingBuilderImpl()
     {
         Args = args
     };
     assembly = new TestAssembly()
     {
         Name = "THE_ASSEMBLY_PATH",
         Fixtures = new List<TestFixture>()
         {
             new TestFixture() { Name = "Fixture2", Group = "groupA", Exclusive = false },
             new TestFixture() { Name = "Fixture3", Group = null, Exclusive = false },
             new TestFixture() { Name = "Fixture3A", Group = null, Exclusive = false },
             new TestFixture() { Name = "Fixture1", Group = null, Exclusive = false },
             new TestFixture() { Name = "Fixture3B", Group = "groupB", Exclusive = false },
             new TestFixture() { Name = "Fixture4", Group = null, Exclusive = true },
             new TestFixture() { Name = "Fixture2A", Group = null, Exclusive = true },
             new TestFixture() { Name = "Fixture2B", Group = null, Exclusive = false }
         }
     };
 }