Beispiel #1
0
        protected override void Action_Starting(Core.Dom.Action action)
        {
            var rec = new Fault.Action()
            {
                name   = action.name,
                type   = action.type,
                models = new List <Fault.Model>()
            };

            foreach (var data in action.allData)
            {
                rec.models.Add(new Fault.Model()
                {
                    name      = data.dataModel.name,
                    parameter = data.name ?? "",
                    dataSet   = data.selectedData != null ? data.selectedData.name : "",
                    mutations = new List <Fault.Mutation>(),
                });
            }

            if (rec.models.Count == 0)
            {
                rec.models = null;
            }

            states.Last().actions.Add(rec);
        }
Beispiel #2
0
 private void RecordDataModel(Core.Dom.Action action)
 {
     foreach (var item in action.outputData)
     {
         GatherMutators(item.instanceName, item.dataModel);
     }
 }
Beispiel #3
0
        private void MutateDataModel(Core.Dom.Action action)
        {
            // MutateDataModel should only be called after ParseDataModel
            System.Diagnostics.Debug.Assert(_iteration > 0);

            foreach (var item in action.outputData)
            {
                ApplyMutation(item);
            }
        }
Beispiel #4
0
        private void RecordDataModel(Core.Dom.Action action)
        {
            // ParseDataModel should only be called during iteration 0
            System.Diagnostics.Debug.Assert(_context.controlIteration && _context.controlRecordingIteration);

            foreach (var item in action.outputData)
            {
                var instanceName = item.instanceName;
                GatherMutators(instanceName, item.dataModel);
            }
        }
Beispiel #5
0
        private void Action_Starting(Core.Dom.Action action)
        {
            // Is this a supported action?
            if (!(action.type == ActionType.Output || action.type == ActionType.SetProperty || action.type == ActionType.Call))
            {
                return;
            }

            if (!_context.controlIteration)
            {
                MutateDataModel(action);
            }

            else if (_context.controlIteration && _context.controlRecordingIteration)
            {
                RecordDataModel(action);
            }
        }
Beispiel #6
0
        private void Action_Starting(Core.Dom.Action action)
        {
            // Is this a supported action?
            if (!action.outputData.Any())
            {
                return;
            }

            if (!_context.controlIteration)
            {
                MutateDataModel(action);
            }

            else if (_context.controlIteration && _context.controlRecordingIteration)
            {
                RecordDataModel(action);
            }
        }
Beispiel #7
0
        private void RecordDataSet(Core.Dom.Action action)
        {
            foreach (var item in action.outputData)
            {
                var options = item.allData.ToList();

                if (options.Count > 0)
                {
                    // Don't use the instance name here, we only pick the data set
                    // once per state, not each time the state is re-entered.
                    var rec = new DataSetTracker(item.modelName, options);

                    if (!_dataSets.Contains(item.modelName))
                    {
                        _dataSets.Add(rec);
                    }
                }
            }
        }
Beispiel #8
0
 private void RecordDataModel(Core.Dom.Action action)
 {
     if (action.dataModel != null)
     {
         string modelName = GetDataModelName(action);
         GatherMutators(modelName, action.dataModel);
     }
     else if (action.parameters != null)
     {
         foreach (ActionParameter param in action.parameters)
         {
             if (param.dataModel != null)
             {
                 string modelName = GetDataModelName(action, param);
                 GatherMutators(modelName, param.dataModel);
             }
         }
     }
 }
Beispiel #9
0
        private void RecordDataModel(Core.Dom.Action action)
        {
            // ParseDataModel should only be called during iteration 0
            System.Diagnostics.Debug.Assert(_context.controlIteration && _context.controlRecordingIteration);

            if (action.dataModel != null)
            {
                string modelName = GetDataModelName(action);
                GatherMutators(modelName, action.dataModel as DataElementContainer);
            }
            else if (action.parameters != null && action.parameters.Count > 0)
            {
                foreach (ActionParameter param in action.parameters)
                {
                    if (param.dataModel != null)
                    {
                        string modelName = GetDataModelName(action, param);
                        GatherMutators(modelName, param.dataModel as DataElementContainer);
                    }
                }
            }
        }
Beispiel #10
0
        private void MutateDataModel(Core.Dom.Action action)
        {
            // MutateDataModel should only be called after ParseDataModel
            System.Diagnostics.Debug.Assert(_iteration > 0);

            if (action.dataModel != null)
            {
                string modelName = GetDataModelName(action);
                ApplyMutation(modelName, action.dataModel);
            }
            else if (action.parameters != null)
            {
                foreach (var param in action.parameters)
                {
                    if (param.dataModel != null)
                    {
                        string modelName = GetDataModelName(action, param);
                        ApplyMutation(modelName, param.dataModel);
                    }
                }
            }
        }
Beispiel #11
0
        private void RecordDataSet(Core.Dom.Action action)
        {
            if (action.dataSet != null)
            {
                DataSetTracker val = new DataSetTracker();
                foreach (var item in action.dataSet.Datas)
                {
                    switch (item.DataType)
                    {
                    case DataType.File:
                        val.options.Add(item);
                        break;

                    case DataType.Files:
                        val.options.AddRange(item.Files.Select(a => new Data()
                        {
                            DataType = DataType.File, FileName = a
                        }));
                        break;

                    case DataType.Fields:
                        val.options.Add(item);
                        break;

                    default:
                        throw new PeachException("Unexpected DataType: " + item.DataType.ToString());
                    }
                }

                if (val.options.Count > 0)
                {
                    // Need to properly support more than one action that are unnamed
                    string key = GetDataModelName(action);
                    System.Diagnostics.Debug.Assert(!_dataSets.ContainsKey(key));
                    _dataSets.Add(key, val);
                }
            }
        }
Beispiel #12
0
 protected virtual void Action_Starting(Core.Dom.Action action)
 {
 }
Beispiel #13
0
 protected virtual void Action_Finished(Core.Dom.Action action)
 {
 }