Example #1
0
 public GameplayApi(IScenarioExecutor scenarioExecutor, IScenarioFactory scenarioFactory, ILogger <GameplayApi> logger)
 {
     this._scenarioExecutor = scenarioExecutor;
     this._scenarioFactory  = scenarioFactory;
     this._logger           = logger;
     this._scenarioBuilder  = new ScenarioDecoratorBuilder(this._scenarioFactory);
 }
        /// <summary>
        /// Initializes runner for given feature test class type with given progress notifier.
        /// Given featureTestClass type Name is used as feature name.
        /// If test class is annotated with [FeatureDescription] attribute or implementation specific description attribute, it's content is used as feature description.
        /// </summary>
        /// <param name="featureTestClass">Test class type.</param>
        /// <param name="progressNotifier">Progress notifier.</param>
        /// <param name="metadataProvider">Test metadata provider.</param>
        protected AbstractBDDRunner(Type featureTestClass, TestMetadataProvider metadataProvider, IProgressNotifier progressNotifier)
        {
            if (featureTestClass == null)
            {
                throw new ArgumentNullException("featureTestClass");
            }
            if (metadataProvider == null)
            {
                throw new ArgumentNullException("metadataProvider");
            }
            if (progressNotifier == null)
            {
                throw new ArgumentNullException("progressNotifier");
            }

            _metadataProvider = metadataProvider;
            ProgressNotifier  = progressNotifier;
            _stepsConverter   = new StepsConverter(_metadataProvider, MapExceptionToStatus);
            _result           = new FeatureResult(
                _metadataProvider.GetFeatureName(featureTestClass),
                _metadataProvider.GetFeatureDescription(featureTestClass),
                _metadataProvider.GetFeatureLabel(featureTestClass));
            _executor = new ScenarioExecutor(ProgressNotifier);
            _executor.ScenarioExecuted += _result.AddScenario;
            ProgressNotifier.NotifyFeatureStart(_result.Name, _result.Description, _result.Label);
        }
Example #3
0
        public MainViewModel(AppSettings appSettings, DatabaseSettings dbSettings, IScenarioBuilder scenarioBuilder, IRepository <Scenario> repository, IScenarioExecutor scenarioExecutor, IScenarioFileManager scenarioFileManager)
        {
            Settings             = appSettings;
            DbSettings           = dbSettings;
            _scenarioBuilder     = scenarioBuilder;
            _repository          = repository;
            _scenarioExecutor    = scenarioExecutor;
            _scenarioFileManager = scenarioFileManager;

            _aggregateScenarios = new ObservableCollection <Scenario>();
            _aggregateScenarios.CollectionChanged +=
                (sender, args) =>
            {
                CreateAggregateScenarioCommand.RaiseCanExecuteChanged();
                ClearAggregateScenariosCommand.RaiseCanExecuteChanged();
            };

            ExecuteScenarioCommand         = new RelayCommand <Scenario>(ExecuteScenario);
            DeleteScenarioCommand          = new RelayCommand <Scenario>(DeleteScenario);
            StartCommand                   = new RelayCommand(Start);
            StopCommand                    = new RelayCommand(Stop);
            EditScenarioCommand            = new RelayCommand <Scenario>(EditScenario);
            ExportScenarioCommand          = new RelayCommand <Scenario>(ExportScenario);
            CreateAggregateScenarioCommand = new RelayCommand(CreateAggregateScenario, AnyAggregateScenarios);
            AddAggregateScenarioCommand    = new RelayCommand(AddAggregateScenario, IsAggregateScenario);
            ClearAggregateScenariosCommand = new RelayCommand(ClearAggregateScenarios, AnyAggregateScenarios);

            DbSettings.DbFilePathChanged += DbSettings_DbFilePathChanged;
            LoadScenarios();
            IsRecording = false;
        }
Example #4
0
 public ScenarioBuilder(IStepsConverter stepsConverter, IScenarioExecutor executor, string scenarioName)
 {
     if (string.IsNullOrWhiteSpace(scenarioName))
     {
         throw new ArgumentException("Unable to create scenario without name");
     }
     _stepsConverter = stepsConverter;
     _executor       = executor;
     _scenario.Name  = scenarioName;
 }
Example #5
0
 public void SetExecutor(IScenarioExecutor executor)
 {
     this.executor = executor;
 }
Example #6
0
 public ScenarioElement(IScenarioExecutor executor) : this()
 {
     this.executor = executor;
 }