Closed LodewijkSioen closed 4 years ago
You can write a translator something like this (I haven't tested this code):
using System.Collections.Generic;
using fitSharp.Fit.Engine;
using fitSharp.Fit.Operators;
using fitSharp.Machine.Model;
namespace My.Operators {
public class KeywordTranslator: CellOperator, InvokeSpecialOperator {
public bool CanInvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters) {
return translations.ContainsKey(memberName.Name);
}
public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters) {
return new InvokeFlowKeyword {Processor = Processor}
.InvokeSpecial(instance, new MemberName(translations[memberName.Name]), parameters);
}
readonly Dictionary<string, string> translations = new Dictionary<string, string> {
{"vérifier", "check"}
};
}
}
Then add it in suite.config.xml:
<suiteConfig>
...
<Fit.Operators>
<Add>My.Operators.KeywordTranslator</Add>
</Fit.Operators>
</suiteConfig>
AH, brilliant! We'll try it out and let you know if it worked.
Just to let you know that this worked brilliantly. Only the Ignore keyword couldn't work this way, so we kept that in an custom dofixture.
Thanks for the help!
We write our specifications in Dutch (since that's what we use). In an older version of fitsharp (2.3.5248), we were able to translate the flowkeywords by making a
DoFixture
with methods like this;In fitsharp 2.7.1, these methods are missing and I can't really find a way to emulate this behaviour. I see that those keyword are pretty locked down in
InvokeFlowKeyword
.