コード例 #1
0
 public MyConvention()
 {
     Classes.NameEndsWith("Weeb");
     Methods.Where(m => m.Name.EndsWith("Frob"));
     Parameters(FromInputAttributes);
     CaseExecution.Skip(@case => @case.Method.HasOrInherits <SkipAttribute>());
 }
コード例 #2
0
        public SelfTestConvention()
        {
            Classes
            .Where(testClass => testClass.IsNestedPrivate)
            .NameEndsWith("TestClass");

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

            ClassExecution
            .SortCases((x, y) => String.Compare(x.Name, y.Name, StringComparison.Ordinal));

            CaseExecution
            .Skip(@case => @case.Method.Name.StartsWith("Skip"));
        }
コード例 #3
0
        public CustomConvention()
        {
            Classes
            .Where(type => type.IsInNamespace(GetType().Namespace))
            .NameEndsWith("Tests");

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

            CaseExecution
            .Skip(@case => @case.Method.HasOrInherits <SkipAttribute>() || @case.Method.DeclaringType.HasOrInherits <SkipAttribute>());

            ClassExecution
            .CreateInstancePerTestClass()
            .SortCases((caseA, caseB) => String.Compare(caseA.Name, caseB.Name, StringComparison.Ordinal));
        }
コード例 #4
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()));
        }
コード例 #5
0
        public CustomConvention()
        {
            Classes
            .InTheSameNamespaceAs(typeof(CustomConvention))
            .NameEndsWith("Tests");

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

            CaseExecution
            .Skip(@case => @case.Method.HasOrInherits <SkipAttribute>() || @case.Method.DeclaringType.HasOrInherits <SkipAttribute>(),
                  @case => @case.Method.DeclaringType.HasOrInherits <SkipAttribute>() ? "whole class skipped" : null);

            ClassExecution
            .CreateInstancePerClass()
            .SortCases((caseA, caseB) => String.Compare(caseA.Name, caseB.Name, StringComparison.Ordinal));
        }
コード例 #6
0
        public CustomConvention()
        {
            Classes
            .InTheSameNamespaceAs(typeof(CustomConvention))
            .NameEndsWith("Tests");

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

            CaseExecution
            .Skip(SkipDueToExplicitAttribute, @case => "[Explicit] tests run only when they are individually selected for execution.")
            .Skip(SkipDueToClassLevelSkipAttribute, @case => "whole class skipped")
            .Skip(SkipDueToMethodLevelSkipAttribute);

            ClassExecution
            .CreateInstancePerClass()
            .SortCases((caseA, caseB) => String.Compare(caseA.Name, caseB.Name, StringComparison.Ordinal));
        }
コード例 #7
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)));
        }