Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 public void ExpandPickupWithOutAnExplicitPattern()
 {
     Pickup sh = new Pickup();
     string results = sh.ReplaceShorthandPatternWithFormalRegex("ab{test} d");
     Assert.AreEqual("ab(?<test>.*?) d",results);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 4
0
 public void ExpandPickupWithAnExplicitPattern(string line, string expectedResults)
 {
     Pickup sh = new Pickup();
     string results = sh.ReplaceShorthandPatternWithFormalRegex(line);
     Assert.AreEqual(expectedResults, results);
 }
Ejemplo n.º 5
0
 public void ClearPickupList()
 {
     Pickup pickup = new Pickup();
     pickup.ClearPickupList();
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 7
0
 public ReplaceTokens()
 {
     _pickup = new Pickup();
 }