i'm trying write convention test specifies method should called in contexts - have static empty
getter want allow used in test methods, vis methods decorated testattribute
.
i know should mark getter obsolete, use method etc, want convention test around doesn't break in future.
i guessing want use static analysis through reflection in convention test. how go performing kind of analysis?
yes, roslyn can sort of thing. example of might standalone analysis like:
var solution = solution.load(pathtosolution); foreach (var project in solution.projects) { var type = project.getcompilation().gettypebymetadataname(typenamecontainingmethod); var method = type.getmembers("empty").single(); var references = method.findallreferences(solution); foreach (var referencedsymbol in references) { foreach (var referencelocation in references) { checkifcallisallowed(referencelocation); } } }
you might @ creating code issue walkthrough , code issue template comes roslyn ctp approach doing @ edit time, instead of in test.
Comments
Post a Comment