/// <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);
        }
Ejemplo n.º 2
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>();
        }
Ejemplo n.º 3
0
        public IntegrationTestsConvention()
        {
            _container = new Container(s => s.AddRegistry <IntegrationTestRegistry>());

            Classes
            .Where(TestClassMatcher);

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

            ClassExecution
            .CreateInstancePerClass()
            .UsingFactory(t => _container.GetInstance(t));

            CaseExecution
            .Wrap(CommitBeforeTestCase);

            Parameters(GetMethodParameters);
        }
Ejemplo n.º 4
0
        public TestingConvention()
        {
            Classes
            .NameEndsWith("Tests");

            Methods
            .Where(method => method.IsVoid() || method.IsAsync());

            ClassExecution
            .CreateInstancePerCase();

            CaseExecution
            .Wrap <DbTestBehavior>()
            .Wrap <NestedContainerBehavior>()
            .Skip(@case => @case.Method.HasOrInherits <SkipAttribute>());

            Parameters
            .Add <FromInputAttributes>();
        }
Ejemplo n.º 5
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>();
        }
Ejemplo n.º 6
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>();
        }
Ejemplo n.º 7
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");


            CaseExecution.Wrap <RepeatCase>();
        }