コード例 #1
0
        public async Task ArgumentExtractor_NestedInvocations_ReportsCorrectArguments(string methodName,
                                                                                      string expectedArgument)
        {
            var symbolToUse = await GetTestSymbolFor(methodName);

            var sut = new InvocationArgumentExtractor(_logger);

            var result = await sut.FindArguments(symbolToUse, _solution);

            result.Should().HaveCount(1);
            var arguments = result.First().Arguments;

            arguments.Should().HaveCount(1);
            arguments.First().ToString().Should().Be(expectedArgument);
        }
コード例 #2
0
        private static async Task ArgumentExtraction(IEnumerable <ISymbol> declaredSymbols, Solution solution, ProgramOptions options)
        {
            var argumentExtractor = new InvocationArgumentExtractor(_logger);

            foreach (var symbol in declaredSymbols)
            {
                var argumentResults = await argumentExtractor.FindArguments(symbol, solution);

                _logger.Info("Reporting location and arguments for calls to " + symbol.ToDisplayString());
                foreach (var result in argumentResults.OrderBy(r => r.FilePath))
                {
                    PrintResult(result);
                }
            }
        }
コード例 #3
0
        public async Task ArgumentExtractor_SymbolFound_ReportsCorrectLocation()
        {
            var symbolToUse = await GetTestSymbolFor("LocationTest");

            var sut = new InvocationArgumentExtractor(_logger);

            var result = await sut.FindArguments(symbolToUse, _solution);

            result.Should().HaveCount(1);
            var firstResult = result.First();
            var location    = firstResult.FilePosition;

            location.line.Should().Be(22);
            location.col.Should().Be(23);
        }