コード例 #1
0
        private void Add <T> (OperationType type, string text, Action action)
            where T : IOperationDescriptor
        {
            var operationProvider          = OperationProvider.Create <T>(type, text, action);
            var unsortedOperationProviders = _provider.OperationProviders.Concat(operationProvider);

            _provider.OperationProviders = _operationSorter.Sort(unsortedOperationProviders);
        }
コード例 #2
0
        private void Add <T> (OperationType type, string text, Action <ITestContext> action)
            where T : IOperationDescriptor
        {
            var operationProvider          = OperationProvider.Create <T>(type, text, InjectContextAndGuardAction(action));
            var unsortedOperationProviders = _provider.OperationProviders.Concat(operationProvider);

            _provider.OperationProviders = _operationSorter.Sort(unsortedOperationProviders);
        }
コード例 #3
0
        public void AddSetupCleanup <TSetup, TCleanup> (string setupText, Action setup, string cleanupText, Action cleanup)
            where TSetup : IActionDescriptor
            where TCleanup : ICleanupDescriptor
        {
            // TODO: shared code with TestController
            IOperationProvider cleanupProvider = null;

            if (cleanup != null)
            {
                cleanupProvider = OperationProvider.Create <TCleanup>(OperationType.Action, cleanupText, cleanup);
            }
            var setupProvider = OperationProvider.Create <TSetup>(OperationType.Action, setupText, setup, cleanupProvider);
            var unsortedOperationProviders = cleanupProvider.Concat(_provider.ContextProviders).Concat(setupProvider).WhereNotNull();

            _provider.ContextProviders = _operationSorter.Sort(unsortedOperationProviders);
        }