Esempio n. 1
0
        public TestConvention()
        {
            Classes.NameEndsWith("Test");
            ClassExecution.CreateInstancePerCase();

            Methods.Where(x => x.IsVoid() && x.IsPublic);

            FixtureExecution.Wrap <AMFixtureBehavior>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LightInjectConvention"/> class.
        /// </summary>
        public LightInjectConvention()
        {
            FixtureExecution.Wrap(WrapFixtureExecution);

            CaseExecution.Wrap(WrapCaseExecution);

            ClassExecution.Wrap(WrapClassExecution);

            ClassExecution.UsingFactory(CreateTestClassInstance);
        }
Esempio n. 3
0
        public FixturePerMethodConvention()
        {
            Classes
            .ConstructorDoesntHaveArguments();
            ClassExecution
            .CreateInstancePerCase();

            FixtureExecution
            .Wrap <ClearPermissions>()
            .Wrap <DeleteData>();
        }
        public FixturePerMethodConvention()
        {
            Classes
            .IsBddStyleClassNameOrEndsWithTests()
            .ConstructorDoesntHaveArguments();

            ClassExecution
            .CreateInstancePerCase();

            FixtureExecution
            .Wrap <DeleteData>();
        }
Esempio n. 5
0
        public TestConvention()
        {
            FixtureExecution.Wrap <FixtureSetupBehavior>();

            Classes.NameEndsWith("test", "Test");

            Methods
            .Where(x =>
                   x.IsVoid() &&
                   x.IsPublic &&
                   x.Name != "FixtureSetup" &&
                   x.Name != "FixtureTearDown");

            ClassExecution
            .CreateInstancePerClass();
        }
Esempio n. 6
0
        public CustomConvention()
        {
            Classes
            .Where(HasAnyFactMethods);

            Methods
            .HasOrInherits <FactAttribute>();

            ClassExecution
            .CreateInstancePerCase()
            .Wrap <PrepareAndDisposeFixtureData>()
            .ShuffleCases();

            FixtureExecution
            .Wrap <InjectFixtureData>();
        }
Esempio n. 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixieSpecConvention"/> class.
        /// </summary>
        public FixieSpecConvention()
        {
            Methods
            .Where(method => method.IsAssertionStep());

            ClassExecution
            .CreateInstancePerClass()
            .SortCases((firstCase, secondCase) => DeclarationOrderComparer.Default.Compare(firstCase.Method, secondCase.Method));

            CaseExecution
            .Skip(SkipWhenSpecificationIsInconclusive)
            .Skip(SkipWhenAssertionStepIsInconclusive);

            FixtureExecution
            .Wrap(new ExecuteSpecificationSteps(method => method.IsTransitionStep()))
            .Wrap(new ExecuteSpecificationSteps(method => method.IsSetupStep()));
        }
Esempio n. 8
0
        public CustomConvention()
        {
            Classes
            .HasOrInherits <TestFixtureAttribute>();

            Methods
            .HasOrInherits <TestAttribute>().Where(m => !m.HasAttribute <ExplicitAttribute>());

            ClassExecution
            .CreateInstancePerClass()
            .SortCases((caseA, caseB) => String.Compare(caseA.Name, caseB.Name, StringComparison.Ordinal));

            FixtureExecution
            .Wrap <FixtureSetUpTearDown>();

            CaseExecution
            .Wrap <SetUpTearDown>();
        }
Esempio n. 9
0
        public FixturePerMethodConvention()
        {
            Classes
            .ClassNameIsBddStyleOrEndsWithTests()
            .ConstructorDoesntHaveArguments();

            ClassExecution
            .CreateInstancePerCase();

            Parameters.Add(
                methodInfo =>
                (methodInfo.GetParameters().Length == 1) &&
                (methodInfo.GetParameters()[0].ParameterType == typeof(SliceFixture))
                                ? new[] { new[] { new SliceFixture() } }
                                : null);

            FixtureExecution.Wrap <DeleteData>();
        }
Esempio n. 10
0
        public CustomConvention()
        {
            Classes
            .Where(HasAnyFactMethods);

            Methods
            .HasOrInherits <FactAttribute>();

            ClassExecution
            .CreateInstancePerCase()
            .Wrap <PrepareAndDisposeFixtureData>()
            .ShuffleCases();

            FixtureExecution
            .Wrap <InjectFixtureData>();

            CaseExecution
            .Skip(c => c.Method.GetCustomAttributes <FactAttribute>().Any(fa => !string.IsNullOrEmpty(fa.Skip)));
        }
Esempio n. 11
0
        public TestConvention()
        {
            FixtureExecution.Wrap <FixtureSetupBehavior>();

            Classes
            .NameEndsWith("test", "Test");

            ClassExecution
            .CreateInstancePerClass();


            Methods
            .Where(
                x => x.IsVoid() &&
                x.IsPublic &&
                x.CustomAttributes.All(a => a.AttributeType.Name != "IgnoreAttribute") &&
                x.Name != "FixtureSetup" &&
                x.Name != "FixtureTearDown" &&
                x.Name != "RegisterDatabase");
        }
Esempio n. 12
0
        public CustomConvention()
        {
            Classes
            .Where(type => type.IsInNamespace(GetType().Namespace))
            .NameEndsWith("Tests");

            Methods
            .Where(method => method.IsVoid())
            .Where(method => LifecycleMethods.All(x => x != method.Name));

            ClassExecution
            .CreateInstancePerClass()
            .SortCases((caseA, caseB) => String.Compare(caseA.Name, caseB.Name, StringComparison.Ordinal));

            FixtureExecution
            .Wrap <CallFixtureSetUpTearDownMethodsByName>();

            CaseExecution
            .Wrap <CallSetUpTearDownMethodsByName>();
        }
Esempio n. 13
0
        public CustomConvention()
        {
            Classes
            .HasOrInherits <TestFixtureAttribute>();

            Methods
            .HasOrInherits <TestAttribute>();

            Parameters
            .Add <TestCaseSourceAttributeParameterSource>();

            ClassExecution
            .CreateInstancePerClass()
            .SortCases((caseA, caseB) => String.Compare(caseA.Name, caseB.Name, StringComparison.Ordinal));

            FixtureExecution
            .Wrap <FixtureSetUpTearDown>();

            CaseExecution
            .Wrap <SupportExpectedExceptions>()
            .Wrap <SetUpTearDown>();
        }
Esempio n. 14
0
        public FullSliceConvention()
        {
            var env = Options <CliArgs>();

            Classes
            .IsBddStyleClassNameOrEndsWithTests()
            .HasNoClassAttributes();

            ClassExecution
            .CreateInstancePerCase();

            Methods
            .Where(method => method.IsPublic);

            Parameters.Add(
                mi =>
                (mi.GetParameters().Length == 1) &&
                (mi.GetParameters()[0].ParameterType == typeof(FullSliceFixture))
                        ? new[] { new[] { new FullSliceFixture(env.Env) } }
                        : null);

            FixtureExecution
            .Wrap <DeleteData>();
        }