From 0cb651d31e356811ee1c222a7c3388fc065a8b62 Mon Sep 17 00:00:00 2001 From: tpodolak Date: Sun, 12 Aug 2018 19:27:39 +0200 Subject: [PATCH] [GH-30] - additional tests for Visual Basic implementation --- .../DiagnosticAnalyzers/CallInfoCallFinder.cs | 32 +- .../ReturnsAsExtensionMethodsTests.cs | 676 ++++++++---------- 2 files changed, 327 insertions(+), 381 deletions(-) diff --git a/src/NSubstitute.Analyzers.VisualBasic/DiagnosticAnalyzers/CallInfoCallFinder.cs b/src/NSubstitute.Analyzers.VisualBasic/DiagnosticAnalyzers/CallInfoCallFinder.cs index 6d729972..0ebda4d8 100644 --- a/src/NSubstitute.Analyzers.VisualBasic/DiagnosticAnalyzers/CallInfoCallFinder.cs +++ b/src/NSubstitute.Analyzers.VisualBasic/DiagnosticAnalyzers/CallInfoCallFinder.cs @@ -41,30 +41,32 @@ public override void VisitInvocationExpression(InvocationExpressionSyntax node) if (symbol != null && symbol.ContainingType.ToString().Equals(MetadataNames.NSubstituteCoreFullTypeName)) { - if (symbol.Name == MetadataNames.CallInfoArgAtMethod) + switch (symbol.Name) { - ArgAtInvocations.Add(node); - } - - if (symbol.Name == MetadataNames.CallInfoArgMethod) - { - ArgInvocations.Add(node); + case MetadataNames.CallInfoArgAtMethod: + ArgAtInvocations.Add(node); + break; + case MetadataNames.CallInfoArgMethod: + ArgInvocations.Add(node); + break; + case "Item": + DirectIndexerAccesses.Add(node); + break; } } - var expressionSymbol = _semanticModel.GetSymbolInfo(node.Expression).Symbol; - if (symbol == null && expressionSymbol != null && expressionSymbol.ContainingType.ToString().Equals(MetadataNames.NSubstituteCoreFullTypeName)) + if (symbol == null) { - DirectIndexerAccesses.Add(node); + var expressionSymbol = _semanticModel.GetSymbolInfo(node.Expression).Symbol; + + if (expressionSymbol != null && expressionSymbol.ContainingType.ToString().Equals(MetadataNames.NSubstituteCoreFullTypeName)) + { + DirectIndexerAccesses.Add(node); + } } base.VisitInvocationExpression(node); } - - public override void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) - { - base.VisitMemberAccessExpression(node); - } } } } \ No newline at end of file diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/CallInfoAnalyzerTests/ReturnsAsExtensionMethodsTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/CallInfoAnalyzerTests/ReturnsAsExtensionMethodsTests.cs index b1d20812..2feec52f 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/CallInfoAnalyzerTests/ReturnsAsExtensionMethodsTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/CallInfoAnalyzerTests/ReturnsAsExtensionMethodsTests.cs @@ -9,37 +9,33 @@ namespace NSubstitute.Analyzers.Tests.VisualBasic.DiagnosticAnalyzersTests.CallI public class ReturnsAsExtensionMethodsTests : CallInfoDiagnosticVerifier { [Theory] - [InlineData("callInfo.ArgAt(1);", 18, 17)] - [InlineData("var x = callInfo[1];", 18, 25)] - [InlineData("callInfo[1] = 1;", 18, 17)] - [InlineData("var x = callInfo.Args()[1];", 18, 25)] - [InlineData("callInfo.Args()[1] = 1;", 18, 17)] - [InlineData("callInfo.ArgTypes()[1] = typeof(int);", 18, 17)] + [InlineData("callInfo.ArgAt(Of Integer)(1)", 13, 63)] + [InlineData("Dim x = callInfo(1)", 13, 71)] + [InlineData("callInfo(1) = 1", 13, 63)] + [InlineData("Dim x = callInfo.Args()(1)", 13, 71)] + [InlineData("callInfo.Args()(1) = 1", 13, 63)] + [InlineData("callInfo.ArgTypes()(1) = GetType(Integer)", 13, 63)] public override async Task ReportsDiagnostic_WhenAccessingArgumentOutOfBounds(string argAccess, int expectedLine, int expectedColumn) { - var source = $@"using System; -using NSubstitute; - -namespace MyNamespace -{{ - public interface Foo - {{ - int Bar(int x); - }} - - public class FooTests - {{ - public void Test() - {{ - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any()).Returns(callInfo => - {{ - {argAccess} - return 1; - }}); - }} - }} -}}"; + var source = $@"Imports System +Imports NSubstitute + +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Integer) As Integer + End Interface + + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Integer)()).Returns(Function(callInfo) + {argAccess} + Return 1 + End Function) + End Sub + End Class +End Namespace +"; var expectedDiagnostic = new DiagnosticResult { Id = DiagnosticIdentifiers.CallInfoArgumentOutOfRange, @@ -55,77 +51,70 @@ public void Test() } [Theory] - [InlineData("callInfo.ArgAt(0);")] - [InlineData("callInfo.ArgAt(1);")] - [InlineData("var x = callInfo[0];")] - [InlineData("var x = callInfo[1];")] - [InlineData("var x = callInfo.Args()[0];")] - [InlineData("var x = callInfo.Args()[1];")] - [InlineData("var x = callInfo.ArgTypes()[0];")] - [InlineData("var x = callInfo.ArgTypes()[1];")] + [InlineData("callInfo.ArgAt(Of Integer)(0)")] + [InlineData("callInfo.ArgAt(Of Integer)(1)")] + [InlineData("Dim x = callInfo(0)")] + [InlineData("Dim x = callInfo(1)")] + [InlineData("Dim x = callInfo.Args()(0)")] + [InlineData("Dim x = callInfo.Args()(1)")] + [InlineData("Dim x = callInfo.ArgTypes()(0)")] + [InlineData("Dim x = callInfo.ArgTypes()(1)")] public override async Task ReportsNoDiagnostic_WhenAccessingArgumentWithinBounds(string argAccess) { - var source = $@"using System; -using NSubstitute; - -namespace MyNamespace -{{ - public interface Foo - {{ - int Bar(int x, int y); - }} - - public class FooTests - {{ - public void Test() - {{ - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any(), Arg.Any()).Returns(callInfo => - {{ - {argAccess} - return 1; - }}); - }} - }} -}}"; + var source = $@"Imports System +Imports NSubstitute + +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Integer, ByVal y As Integer) As Integer + End Interface + + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Integer)(), Arg.Any(Of Integer)()).Returns(Function(callInfo) + {argAccess} + Return 1 + End Function) + End Sub + End Class +End Namespace +"; await VerifyDiagnostic(source); } [Theory] - [InlineData("callInfo.ArgAt(1);", 22, 17)] - [InlineData("var x = (Bar)callInfo[1];", 22, 30)] - [InlineData("var x = callInfo[1] as Bar;", 22, 25)] - [InlineData("var x = (Bar)callInfo.Args()[1];", 22, 30)] - [InlineData("var x = callInfo.Args()[1] as Bar;", 22, 25)] + [InlineData("callInfo.ArgAt(Of Bar)(1)", 16, 85)] + [InlineData("Dim x = CType(callInfo(1), Bar)", 16, 99)] + [InlineData("Dim x = TryCast(callInfo(1), Bar)", 16, 101)] + [InlineData("Dim x = DirectCast(callInfo(1), Bar)", 16, 104)] + [InlineData("Dim x = CType(callInfo.Args()(1), Bar)", 16, 99)] + [InlineData("Dim x = TryCast(callInfo.Args()(1), Bar)", 16, 101)] + [InlineData("Dim x = DirectCast(callInfo.Args()(1), Bar)", 16, 104)] public override async Task ReportsDiagnostic_WhenConvertingTypeToUnsupportedType(string argAccess, int expectedLine, int expectedColumn) { - var source = $@"using System; -using NSubstitute; - -namespace MyNamespace -{{ - public interface Foo - {{ - int Bar(int x, double y); - }} - - public class Bar - {{ - }} - - public class FooTests - {{ - public void Test() - {{ - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any(), Arg.Any()).Returns(callInfo => - {{ - {argAccess} - return 1; - }}); - }} - }} -}}"; + var source = $@"Imports System +Imports NSubstitute + +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Integer, ByVal y As Double) As Integer + End Interface + + Public Class Bar + End Class + + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Integer)(), Arg.Any(Of Double)()).Returns(Function(callInfo) + {argAccess} + Return 1 + End Function) + End Sub + End Class +End Namespace +"; var expectedDiagnostic = new DiagnosticResult { Id = DiagnosticIdentifiers.CallInfoCouldNotConvertParameterAtPosition, @@ -177,109 +166,96 @@ End Namespace } [Theory] - [InlineData("var x = callInfo.ArgTypes() as object;")] - [InlineData("var x = (object)callInfo.ArgTypes();")] + [InlineData("Dim x = TryCast(callInfo.ArgTypes(), Object)")] + [InlineData("Dim x = DirectCast(callInfo.ArgTypes(), Object)")] + [InlineData("Dim x = CType(callInfo.ArgTypes(), Object)")] public override async Task ReportsNoDiagnostic_WhenCastingElementsFromArgTypes(string argAccess) { - var source = $@"using System; -using NSubstitute; - -namespace MyNamespace -{{ - public interface Foo - {{ - int Bar(Bar x); - }} - - public class Bar - {{ - }} - - public class FooTests - {{ - public void Test() - {{ - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any()).Returns(callInfo => - {{ - {argAccess} - return 1; - }}); - }} - }} -}}"; + var source = $@"Imports System +Imports NSubstitute + +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Bar) As Integer + End Interface + + Public Class Bar + End Class + + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Bar)()).Returns(Function(callInfo) + {argAccess} + Return 1 + End Function) + End Sub + End Class +End Namespace +"; await VerifyDiagnostic(source); } [Theory] - [InlineData("callInfo.ArgTypes()[0] = typeof(object);")] - [InlineData("callInfo.Args()[0] = 1m;")] + [InlineData("callInfo.ArgTypes()(0) = GetType(Object)")] + [InlineData("callInfo.Args()(0) = 1D")] public override async Task ReportsNoDiagnostic_WhenAssigningValueToNotRefNorOutArgumentViaIndirectCall(string argAccess) { - var source = $@"using System; -using NSubstitute; - -namespace MyNamespace -{{ - public interface Foo - {{ - int Bar(Bar x); - }} - - public class Bar - {{ - }} - - public class FooTests - {{ - public void Test() - {{ - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any()).Returns(callInfo => - {{ - {argAccess} - return 1; - }}); - }} - }} -}}"; + var source = $@"Imports System +Imports NSubstitute + +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Bar) As Integer + End Interface + + Public Class Bar + End Class + + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Bar)()).Returns(Function(callInfo) + {argAccess} + Return 1 + End Function) + End Sub + End Class +End Namespace +"; await VerifyDiagnostic(source); } [Fact] public override async Task ReportsDiagnostic_WhenAccessingArgumentByTypeNotInInvocation() { - var source = @"using System; -using NSubstitute; + var source = @"Imports System +Imports NSubstitute -namespace MyNamespace -{ - public interface Foo - { - int Bar(int x); - } +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Integer) As Integer + End Interface - public class FooTests - { - public void Test() - { - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any()).Returns(callInfo => - { - callInfo.Arg(); - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Integer)()).Returns(Function(callInfo) + callInfo.Arg(Of Double)() + Return 1 + End Function) + End Sub + End Class +End Namespace +"; var expectedDiagnostic = new DiagnosticResult { Id = DiagnosticIdentifiers.CallInfoCouldNotFindArgumentToThisCall, Severity = DiagnosticSeverity.Warning, - Message = "Can not find an argument of type double to this call.", + Message = "Can not find an argument of type Double to this call.", Locations = new[] { - new DiagnosticResultLocation(18, 17) + new DiagnosticResultLocation(13, 63) } }; @@ -289,29 +265,25 @@ public void Test() [Fact] public override async Task ReportsNoDiagnostic_WhenAccessingArgumentByTypeInInInvocation() { - var source = @"using System; -using NSubstitute; + var source = @"Imports System +Imports NSubstitute -namespace MyNamespace -{ - public interface Foo - { - int Bar(int x); - } +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Integer) As Integer + End Interface - public class FooTests - { - public void Test() - { - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any()).Returns(callInfo => - { - callInfo.Arg(); - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Integer)()).Returns(Function(callInfo) + callInfo.Arg(Of Integer)() + Return 1 + End Function) + End Sub + End Class +End Namespace +"; await VerifyDiagnostic(source); } @@ -319,36 +291,32 @@ public void Test() [Fact] public override async Task ReportsDiagnostic_WhenAccessingArgumentByTypeMultipleTimesInInvocation() { - var source = @"using NSubstitute; + var source = @"Imports NSubstitute -namespace MyNamespace -{ - public interface Foo - { - int Bar(int x, int y); - } +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Integer, ByVal y As Integer) As Integer + End Interface - public class FooTests - { - public void Test() - { - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any(), Arg.Any()).Returns(callInfo => - { - callInfo.Arg(); - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Integer)(), Arg.Any(Of Integer)()).Returns(Function(callInfo) + callInfo.Arg(Of Integer)() + Return 1 + End Function) + End Sub + End Class +End Namespace +"; var expectedDiagnostic = new DiagnosticResult { Id = DiagnosticIdentifiers.CallInfoMoreThanOneArgumentOfType, Severity = DiagnosticSeverity.Warning, - Message = "There is more than one argument of type int to this call.", + Message = "There is more than one argument of type Integer to this call.", Locations = new[] { - new DiagnosticResultLocation(17, 17) + new DiagnosticResultLocation(12, 86) } }; @@ -358,28 +326,24 @@ public void Test() [Fact] public override async Task ReportsNoDiagnostic_WhenAccessingArgumentByTypeMultipleDifferentTypesInInvocation() { - var source = @"using NSubstitute; + var source = @"Imports NSubstitute -namespace MyNamespace -{ - public interface Foo - { - int Bar(int x, double y); - } +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Integer, ByVal y As Double) As Integer + End Interface - public class FooTests - { - public void Test() - { - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any(), Arg.Any()).Returns(callInfo => - { - callInfo.Arg(); - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Integer)(), Arg.Any(Of Double)()).Returns(Function(callInfo) + callInfo.Arg(Of Integer)() + Return 1 + End Function) + End Sub + End Class +End Namespace +"; await VerifyDiagnostic(source); } @@ -387,36 +351,32 @@ public void Test() [Fact] public override async Task ReportsDiagnostic_WhenAssigningValueToNotOutNorRefArgument() { - var source = @"using NSubstitute; + var source = @"Imports NSubstitute -namespace MyNamespace -{ - public interface Foo - { - int Bar(int x, double y); - } +Namespace MyNamespace + Interface Foo + Function Bar(ByVal x As Integer, ByVal y As Double) As Integer + End Interface - public class FooTests - { - public void Test() - { - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(Arg.Any(), Arg.Any()).Returns(callInfo => - { - callInfo[1] = 1; - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(Arg.Any(Of Integer)(), Arg.Any(Of Double)()).Returns(Function(callInfo) + callInfo(1) = 1 + Return 1 + End Function) + End Sub + End Class +End Namespace +"; var expectedDiagnostic = new DiagnosticResult { Id = DiagnosticIdentifiers.CallInfoArgumentIsNotOutOrRef, Severity = DiagnosticSeverity.Warning, - Message = "Could not set argument 1 (double) as it is not an out or ref argument.", + Message = "Could not set argument 1 (Double) as it is not an out or ref argument.", Locations = new[] { - new DiagnosticResultLocation(17, 17) + new DiagnosticResultLocation(12, 85) } }; @@ -426,87 +386,77 @@ public void Test() [Fact] public override async Task ReportsNoDiagnostic_WhenAssigningValueToRefArgument() { - var source = @"using NSubstitute; + var source = @"Imports NSubstitute -namespace MyNamespace -{ - public interface Foo - { - int Bar(ref int x); - } +Namespace MyNamespace + Interface Foo + Function Bar(ByRef x As Integer) As Integer + End Interface - public class FooTests - { - public void Test() - { - int value = 0; - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(ref value).Returns(callInfo => - { - callInfo[0] = 1; - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim value As Integer = 0 + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(value).Returns(Function(callInfo) + callInfo(0) = 1 + Return 1 + End Function) + End Sub + End Class +End Namespace +"; await VerifyDiagnostic(source); } [Fact] public override async Task ReportsNoDiagnostic_WhenAssigningValueToOutArgument() { - var source = @"using NSubstitute; + var source = @"Imports NSubstitute +Imports System.Runtime.InteropServices -namespace MyNamespace -{ - public interface Foo - { - int Bar(out int x); - } +Namespace MyNamespace + Interface Foo + Function Bar( ByRef x As Integer) As Integer + End Interface - public class FooTests - { - public void Test() - { - int value = 0; - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(out value).Returns(callInfo => - { - callInfo[0] = 1; - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim value As Integer = 0 + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(value).Returns(Function(callInfo) + callInfo(0) = 1 + Return 1 + End Function) + End Sub + End Class +End Namespace +"; await VerifyDiagnostic(source); } [Fact] public override async Task ReportsDiagnostic_WhenAssigningValueToOutOfBoundsArgument() { - var source = @"using NSubstitute; + var source = @"Imports NSubstitute +Imports System.Runtime.InteropServices -namespace MyNamespace -{ - public interface Foo - { - int Bar(out int x); - } +Namespace MyNamespace + Interface Foo + Function Bar( ByRef x As Integer) As Integer + End Interface - public class FooTests - { - public void Test() - { - int value = 0; - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(out value).Returns(callInfo => - { - callInfo[1] = 1; - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim value As Integer = 0 + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(value).Returns(Function(callInfo) + callInfo(1) = 1 + Return 1 + End Function) + End Sub + End Class +End Namespace +"; var expectedDiagnostic = new DiagnosticResult { Id = DiagnosticIdentifiers.CallInfoArgumentOutOfRange, @@ -514,7 +464,7 @@ public void Test() Message = "There is no argument at position 1", Locations = new[] { - new DiagnosticResultLocation(18, 17) + new DiagnosticResultLocation(14, 47) } }; @@ -524,38 +474,35 @@ public void Test() [Fact] public override async Task ReportsDiagnostic_WhenAssigningWrongTypeToArgument() { - var source = @"using NSubstitute; + var source = @"Imports NSubstitute +Imports System.Runtime.InteropServices -namespace MyNamespace -{ - public interface Foo - { - int Bar(out decimal x); - } +Namespace MyNamespace + Interface Foo + Function Bar( ByRef x As Decimal) As Integer + End Interface - public class FooTests - { - public void Test() - { - decimal value = 0; - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(out value).Returns(callInfo => - { - callInfo[0] = 1; - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim value As Decimal = 0 + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(value).Returns(Function(callInfo) + callInfo(0) = 1 + Return 1 + End Function) + End Sub + End Class +End Namespace +"; var expectedDiagnostic = new DiagnosticResult { Id = DiagnosticIdentifiers.CallInfoArgumentSetWithIncompatibleValue, Severity = DiagnosticSeverity.Warning, - Message = "Could not set value of type int to argument 0 (decimal) because the types are incompatible.", + Message = "Could not set value of type Integer to argument 0 (Decimal) because the types are incompatible.", Locations = new[] { - new DiagnosticResultLocation(18, 17) + new DiagnosticResultLocation(14, 47) } }; @@ -565,29 +512,26 @@ public void Test() [Fact] public override async Task ReportsNoDiagnostic_WhenAssigningProperTypeToArgument() { - var source = @"using NSubstitute; + var source = @"Imports NSubstitute +Imports System.Runtime.InteropServices -namespace MyNamespace -{ - public interface Foo - { - int Bar(out decimal x); - } +Namespace MyNamespace + Interface Foo + Function Bar( ByRef x As Decimal) As Integer + End Interface - public class FooTests - { - public void Test() - { - decimal value = 0; - var substitute = NSubstitute.Substitute.For(); - substitute.Bar(out value).Returns(callInfo => - { - callInfo[0] = 1M; - return 1; - }); - } - } -}"; + Public Class FooTests + Public Sub Test() + Dim value As Decimal = 0 + Dim substitute = NSubstitute.Substitute.[For](Of Foo)() + substitute.Bar(value).Returns(Function(callInfo) + callInfo(0) = 1D + Return 1 + End Function) + End Sub + End Class +End Namespace +"; await VerifyDiagnostic(source); }