public Test BuildFrom(Type type)
        {
            var constructor = type.GetConstructor(new Type[0]);

            Func<SpecificationFixture> fixtureFactory = delegate()
            {
                var fixture = constructor.Invoke(new object[0]) as SpecificationFixture;
                return fixture;
            };

            NativeTestFactory nativeTestFactory = new NativeTestFactory();

            FixtureDiscoveryContext buildContext = new FixtureDiscoveryContext(nativeTestFactory, fixtureFactory, new NameGenerator(), fixtureFactory());

            var globalSetup = new GlobalSetupManager();

            globalSetup.Initialize(fixtureFactory);

            NJasmineTestSuite rootSuite = new NJasmineTestSuite(nativeTestFactory, new TestPosition(), globalSetup);

            TestBuilder root = rootSuite.BuildNJasmineTestSuite(type.Namespace, type.Name, buildContext, globalSetup, buildContext.GetSpecificationRootAction(), true);

            var result = (root.GetUnderlyingTest() as NativeTest).GetNative(root);

            NUnitFramework.ApplyCommonAttributes(type.GetCustomAttributes(false).Cast<Attribute>().ToArray(), result);

            return result;
        }
Exemple #2
0
        public Test BuildFrom(Type type)
        {
            NativeTestFactory nativeTestFactory = new NativeTestFactory();

            SpecificationBuilder.BuildTestFixture(type, nativeTestFactory, new GlobalSetupOwner());

            var result = nativeTestFactory.RootTest.GetNative() as Test;

            NUnitFramework.ApplyCommonAttributes(type.GetCustomAttributes(false).Cast <Attribute>().ToArray(), result);

            return(result);
        }
        public Test BuildFrom(Type type)
        {
            NativeTestFactory nativeTestFactory = new NativeTestFactory();

            SpecificationBuilder.BuildTestFixture(type, nativeTestFactory, new GlobalSetupOwner());

            var result = nativeTestFactory.RootTest.GetNative() as Test;

            NUnitFramework.ApplyCommonAttributes(type.GetCustomAttributes(false).Cast<Attribute>().ToArray(), result);

            return result;
        }