private void Init(ITextSnapshot textSnapshot) { var methods = methodsExtractor.Extract(textSnapshot.GetText()) .OfType <ISyntaxNode>(); syntaxNodes = methods.ToDictionary(method => method, method => method); }
private void Init(ITextSnapshot textSnapshot) { IEnumerable <IMethod> methods = methodsExtractor.Extract(textSnapshot.GetText()) .Where(method => method.BodyEnd.Line >= 0); methodToText = methods.ToDictionary(method => method, method => GetText(textSnapshot, method)); }
public void Calculate_SingleInterfaceWithSingleMethod_ShouldReturnDefaultValue() { const string fileCode = @"using System; namespace SomeNamespace { public interface ISomeInterface { void SomeMethod(object input); } }"; var syntaxNodes = extractor.Extract(fileCode); var syntaxNode = syntaxNodes.OfType <ISyntaxNode>().FirstOrDefault(); var complexity = calculator.Calculate(syntaxNode); Assert.That(complexity.Value, Is.EqualTo(1)); }
protected IEnumerable <ISyntaxNode> ExtractSyntaxNodes(string fileCode) { return(extractor.Extract(fileCode).OfType <ISyntaxNode>()); }