I am trying to create a small template that builds the skeletton for our TestMethods, based on the naming conventions we use on the project.
Our conventions expect our TestMethods to look like this :
public void PublicationProcess_Execute_with_no_changes_returns_zero()
var p = new PublicationProcess();
var result = p.Execute();
Assert.Inconclusive("EDITME : Assert returns zero for PublicationProcess.Execute() with no changes");
typically the big blocks would be :
-tested_class (in that case PublicationProcess)
-tested_method (a method defined for this type)
-test_conditions ( "no changes")
-expected outcome "returns zero"
I would like the user to (in that order) :
-type the Type to test (with completion)
-type the method to test (with completation of possible methods of the selected type)
-type the test condistions with spaces, and this should update the TestMethod name replacing spaces with underscores
-type the expected output with spaces, and this should update the TestMethod name replacing spaces with underscores
I could more or less get the first parts, but using the template seems to fail if I include the variable in a comment : as soon as a start typing one of the variables that are included in the comment, I can no longer access the next variables
public void $tested_object$_$tested_method$_with_$test_conditions$_$expected_result$()
var o = new $tested_object$();
// initial conditions : $test_conditions_with_spaces$
var res = o.$tested_method$();
// TODO : check that: $expected_result_with_spaces$
Assert.Inconclusive("TODO: $expected_result_with_spaces$ for $tested_object$.$tested_method$() with $test_conditions_with_spaces$");
Any idea what can be going wrong ?
I attach an exportation of my template
Thanks in advance !