Пример #1
0
 public void WhenTwoCapturesGiven_ExpectTwo()
 {
     Command command = new Command("^(?<name>[a-z]+).*?(?<second>[0-9]+)");
     Pickup pickup = new Pickup();
     pickup.CollectAllPickupsInLine("ab c 45", command);
     var results = pickup.ReplacePickupsWithStoredValue("${name}");
     Assert.AreEqual("ab", results);
     results = pickup.ReplacePickupsWithStoredValue("${second}");
     Assert.AreEqual("45",results);
 }
Пример #2
0
 public void ExpandPickupWithOutAnExplicitPattern()
 {
     Pickup sh = new Pickup();
     string results = sh.ReplaceShorthandPatternWithFormalRegex("ab{test} d");
     Assert.AreEqual("ab(?<test>.*?) d",results);
 }
Пример #3
0
 public void WhenSameCaptureNameReused_ExpectLastValue()
 {
     Command command = new Command(@"^(?<name>[a-z]+).*?(?<name>[0-9]+)");
     Pickup pickup = new Pickup();
     pickup.CollectAllPickupsInLine("ab c 45", command);
     var results = pickup.ReplacePickupsWithStoredValue("${name}");
     Assert.AreEqual("45", results);
 }
Пример #4
0
 public void ExpandPickupWithAnExplicitPattern(string line, string expectedResults)
 {
     Pickup sh = new Pickup();
     string results = sh.ReplaceShorthandPatternWithFormalRegex(line);
     Assert.AreEqual(expectedResults, results);
 }
Пример #5
0
 public void ClearPickupList()
 {
     Pickup pickup = new Pickup();
     pickup.ClearPickupList();
 }
Пример #6
0
 public void WhenGlobPickup_ExpectHeldValue()
 {
     Command command = new Command(@"a{name}d");
     Pickup pickup = new Pickup();
     pickup.CollectAllPickupsInLine("ab cd",command);
     string results = pickup.ReplacePickupsWithStoredValue("ab${name}");
     Assert.AreEqual("abb c", results);
 }
Пример #7
0
 public ReplaceTokens()
 {
     _pickup = new Pickup();
 }