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); }
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); }
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); }