@Test
  public void testScanSimpleFile() {
    AstScanner<CSharpGrammar> scanner =
        CSharpAstScanner.create(new CSharpConfiguration(Charset.forName("UTF-8")));
    scanner.scanFile(readFile("/metric/simpleFile.cs"));
    SourceProject project =
        (SourceProject)
            scanner.getIndex().search(new QueryByType(SourceProject.class)).iterator().next();

    assertThat(project.getInt(CSharpMetric.STATEMENTS), is(16));
  }
  @Test
  public void check() {
    XPathCheck check = new XPathCheck();
    check.xpathQuery = "//IDENTIFIER[string-length(@tokenValue) >= 10]";
    check.message = "Avoid identifiers which are too long!";

    SourceFile file =
        CSharpAstScanner.scanSingleFile(new File("src/test/resources/checks/xpath.cs"), check);
    checkMessagesVerifier
        .verify(file.getCheckMessages())
        .next()
        .atLine(7)
        .withMessage("Avoid identifiers which are too long!");
  }