コード例 #1
0
        public void SaveLearnedData(string configDir)
        {
            var valueStore   = new ValueStore();
            var stepDefStore = new StepDefStore(valueStore);

            foreach (var stepDefRegex in _stepDefRegexes)
            {
                var paramNames = stepDefRegex.Key.GetValidNames();
                for (int paramNumber = 0; paramNumber < paramNames.Count; paramNumber++)
                {
                    var group    = new ValueStoreGroup(paramNames[paramNumber]);
                    var tmpItems = new HashSet <ValueStoreItem>(ValueStoreItem.RuValueComparer);
                    foreach (var gherkinStep in stepDefRegex.Value)
                    {
                        var item = ValueStoreItem.FromMacros(gherkinStep.Text, paramNumber);
                        if (item == default(ValueStoreItem))
                        {
                            continue;
                        }
                        if (!tmpItems.Contains(item))
                        {
                            tmpItems.Add(item);
                        }
                    }
                    group.Items.AddRange(tmpItems.ToList());
                    valueStore.AddGroup(group);
                    stepDefStore.AddStepDef(stepDefRegex.Key);
                }
            }
            valueStore.Save(ValueStoreConfigsDir, "learned");
            stepDefStore.Save(StepDefStoreConfigsDir, "learned");
        }
コード例 #2
0
 public void AddGroup(ValueStoreGroup group)
 {
     if (!StoreGroups.ContainsKey(group.Name))
     {
         StoreGroups.Add(group.Name, group);
     }
     else
     {
         group = StoreGroups[group.Name];
         group.Items.AddRange(group.Items);
     }
 }
コード例 #3
0
        public void AddValuesToGroup(string groupName, IEnumerable <ValueStoreItem> valueItems)
        {
            ValueStoreGroup group;

            if (!StoreGroups.ContainsKey(groupName))
            {
                group = new ValueStoreGroup(groupName);
                StoreGroups.Add(groupName, group);
            }
            else
            {
                group = StoreGroups[groupName];
            }
            group.Items.AddRange(valueItems);
        }
コード例 #4
0
 public ValueStore(string valueStoresDirectory) : this()
 {
     if (!Directory.Exists(valueStoresDirectory))
     {
         return;
     }
     _configFilesDir = valueStoresDirectory;
     foreach (var file in Directory.EnumerateFiles(valueStoresDirectory, "*.xml", SearchOption.AllDirectories))
     {
         var text = File.ReadAllText(file);
         var xml  = XElement.Parse(text);
         foreach (var group in xml.Descendants("group"))
         {
             var g = new ValueStoreGroup(group);
             AddGroup(g);
         }
     }
 }
コード例 #5
0
 public StepDefParameter(ValueStoreGroup valueStoreGroup, UInt16 index)
 {
     ValueStoreGroup = valueStoreGroup;
     Index           = index;
 }