public void FindReturnStatementsTest() { var methodBody = GenerateMethodBody(PythonCodeGenerator.GenerateDefaultReturnStatement()); var finder = BuildFinder(methodBody); var returnStatements = finder.FindReturnStatements(); Assert.AreEqual(1, returnStatements.Count()); }
public void CountOfDirectStatementsInBodyTest() { var assignmentStatement = PythonCodeGenerator.GenerateDefaultAssignmentStatement(); var embeddedStatement = PythonCodeGenerator.GenerateDefaultCompoundStatement(2); var returnStatement = PythonCodeGenerator.GenerateDefaultReturnStatement(); string[] statements = { assignmentStatement, embeddedStatement, returnStatement }; var methodBody = GenerateMethodBody(statements); var finder = BuildFinder(methodBody); var statementsCount = finder.CountOfDirectStatementsInBody(); Assert.AreEqual(3, statementsCount); }