Skip to content

Commit

Permalink
Address warnings in test projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jviau committed Nov 6, 2024
1 parent 87e8056 commit 2607d23
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 51 deletions.
15 changes: 8 additions & 7 deletions test/DotNetWorkerTests/DefaultModelBindingFeatureTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core.Serialization;
using Microsoft.Azure.Functions.Worker.Context.Features;
using Microsoft.Azure.Functions.Worker.Http;
Expand All @@ -25,7 +26,7 @@ public DefaultModelBindingFeatureTests()
}

[Fact]
public async void BindFunctionInputAsync_Populates_ParametersUsingConverters()
public async Task BindFunctionInputAsync_Populates_ParametersUsingConverters()
{
// Arrange
var parameters = new List<FunctionParameter>()
Expand Down Expand Up @@ -62,7 +63,7 @@ public async void BindFunctionInputAsync_Populates_ParametersUsingConverters()
}

[Fact]
public async void BindFunctionInputAsync_IgnoreCancellationToken()
public async Task BindFunctionInputAsync_IgnoreCancellationToken()
{
// Arrange
var parameters = new List<FunctionParameter>()
Expand Down Expand Up @@ -106,7 +107,7 @@ public async void BindFunctionInputAsync_IgnoreCancellationToken()
}

[Fact]
public async void BindFunctionInputAsync_Populates_Parameter_Using_DefaultValue_When_CouldNot_Populate_From_InputData()
public async Task BindFunctionInputAsync_Populates_Parameter_Using_DefaultValue_When_CouldNot_Populate_From_InputData()
{
var features = new InvocationFeatures(Enumerable.Empty<IInvocationFeatureProvider>());
var httpFunctionDefinition = new TestFunctionDefinition(parameters: new FunctionParameter[]
Expand Down Expand Up @@ -144,7 +145,7 @@ public async void BindFunctionInputAsync_Populates_Parameter_Using_DefaultValue_
}

[Fact]
public async void BindFunctionInputAsync_Populates_Parameter_For_Nullable_Or_ReferenceTypes()
public async Task BindFunctionInputAsync_Populates_Parameter_For_Nullable_Or_ReferenceTypes()
{
var features = new InvocationFeatures(Enumerable.Empty<IInvocationFeatureProvider>());
var httpFunctionDefinition = new TestFunctionDefinition(parameters: new FunctionParameter[]
Expand Down Expand Up @@ -188,7 +189,7 @@ public async void BindFunctionInputAsync_Populates_Parameter_For_Nullable_Or_Ref
}

[Fact]
public async void BindFunctionInputAsync_Throws_When_Explicit_OptionalParametersValueNotPresent()
public async Task BindFunctionInputAsync_Throws_When_Explicit_OptionalParametersValueNotPresent()
{
// 'fooId' is a parameter defined for the function without a default value
// and 'InputData' does not have a corresponding entry for that we could use to populate that parameter.
Expand Down Expand Up @@ -220,7 +221,7 @@ public async void BindFunctionInputAsync_Throws_When_Explicit_OptionalParameters
}

[Fact]
public async void BindFunctionInputAsync_Returns_Cached_Value_When_Called_SecondTime()
public async Task BindFunctionInputAsync_Returns_Cached_Value_When_Called_SecondTime()
{
// Arrange
var parameters = new List<FunctionParameter>()
Expand Down Expand Up @@ -263,7 +264,7 @@ public async void BindFunctionInputAsync_Returns_Cached_Value_When_Called_Second
/// returns the parameter values array for the function definition.
/// </summary>
[Fact]
public async void BindFunctionInputAsync_Populates_ParametersUsingCachedData()
public async Task BindFunctionInputAsync_Populates_ParametersUsingCachedData()
{
// Arrange
var parameters = new List<FunctionParameter>()
Expand Down
8 changes: 4 additions & 4 deletions test/Sdk.Analyzers.Tests/AsyncVoidAnalyzerTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Xunit;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidAnalyzer, Microsoft.CodeAnalysis.Testing.Verifiers.XUnitVerifier>;
using AnalyzerVerifier = Microsoft.CodeAnalysis.CSharp.Testing.XUnit.AnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidAnalyzer>;
using CodeFixTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpCodeFixTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidAnalyzer, Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidCodeFixProvider, Microsoft.CodeAnalysis.Testing.Verifiers.XUnitVerifier>;
using CodeFixVerifier = Microsoft.CodeAnalysis.CSharp.Testing.CSharpCodeFixVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidAnalyzer, Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidCodeFixProvider, Microsoft.CodeAnalysis.Testing.Verifiers.XUnitVerifier>;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidAnalyzer, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using AnalyzerVerifier = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidAnalyzer, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using CodeFixTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpCodeFixTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidAnalyzer, Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidCodeFixProvider, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using CodeFixVerifier = Microsoft.CodeAnalysis.CSharp.Testing.CSharpCodeFixVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidAnalyzer, Microsoft.Azure.Functions.Worker.Sdk.Analyzers.AsyncVoidCodeFixProvider, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using System.Collections.Immutable;
Expand Down
4 changes: 2 additions & 2 deletions test/Sdk.Analyzers.Tests/BindingTypeNotSupportedTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xunit;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.BindingTypeNotSupported, Microsoft.CodeAnalysis.Testing.Verifiers.XUnitVerifier>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.XUnit.AnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.BindingTypeNotSupported>;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.BindingTypeNotSupported, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.BindingTypeNotSupported, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using System.Collections.Immutable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xunit;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.DeferredBindingAttributeNotSupported, Microsoft.CodeAnalysis.Testing.Verifiers.XUnitVerifier>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.XUnit.AnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.DeferredBindingAttributeNotSupported>;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.DeferredBindingAttributeNotSupported, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.DeferredBindingAttributeNotSupported, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using System.Collections.Immutable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xunit;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.IterableBindingTypeExpectedForBlobContainerPath, Microsoft.CodeAnalysis.Testing.Verifiers.XUnitVerifier>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.XUnit.AnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.IterableBindingTypeExpectedForBlobContainerPath>;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.IterableBindingTypeExpectedForBlobContainerPath, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.IterableBindingTypeExpectedForBlobContainerPath, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using System.Collections.Immutable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xunit;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.WebJobsAttributesNotSupported, Microsoft.CodeAnalysis.Testing.Verifiers.XUnitVerifier>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.XUnit.AnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.WebJobsAttributesNotSupported>;
using AnalyzerTest = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerTest<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.WebJobsAttributesNotSupported, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier<Microsoft.Azure.Functions.Worker.Sdk.Analyzers.WebJobsAttributesNotSupported, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using System.Collections.Immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.Azure.Functions.Worker.Sdk.Generators;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Testing;
Expand Down Expand Up @@ -54,7 +55,7 @@ public DiagnosticResultTests()
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void MultipleOutputBindingsOnMethodFails(LanguageVersion languageVersion)
public async Task MultipleOutputBindingsOnMethodFails(LanguageVersion languageVersion)
{
var inputCode = @"using System;
using System.Net;
Expand Down Expand Up @@ -106,7 +107,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void MultipleOutputBindingsOnPropertyFails(LanguageVersion languageVersion)
public async Task MultipleOutputBindingsOnPropertyFails(LanguageVersion languageVersion)
{
var inputCode = @"using System.Net;
using Microsoft.Azure.Functions.Worker;
Expand Down Expand Up @@ -167,7 +168,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void MultipleHttpResponseBindingsFails(LanguageVersion languageVersion)
public async Task MultipleHttpResponseBindingsFails(LanguageVersion languageVersion)
{
var inputCode = @"using System;
using System.Threading.Tasks;
Expand Down Expand Up @@ -223,7 +224,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void InvalidRetryOptionsFailure(LanguageVersion languageVersion)
public async Task InvalidRetryOptionsFailure(LanguageVersion languageVersion)
{
var inputCode = @"using System;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.Functions.Worker.Sdk.Generators;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Testing;
Expand Down Expand Up @@ -58,7 +59,7 @@ public EventHubsBindingsTests()
[InlineData("DictionaryInputFunction", "Dictionary<string, string>", "")]
[InlineData("LookupFunction", "Lookup<string, int>", "")]
[InlineData("ConcurrentDictionaryInputFunction", "ConcurrentDictionary<string, string>", "")]
public async void FunctionsWithIsBatchedFalse(string functionName, string parameterType, string dataType)
public async Task FunctionsWithIsBatchedFalse(string functionName, string parameterType, string dataType)
{
StringBuilder inputCodeBuilder = new StringBuilder();
inputCodeBuilder.Append(_usingStringsForInput);
Expand Down Expand Up @@ -170,7 +171,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData("EnumerableInputFunction", "IEnumerable", "")]
[InlineData("EnumerableClassInputFunction", "EnumerableTestClass", "")]
[InlineData("EnumerableGenericClassInputFunction", "EnumerableGenericTestClass", "")]
public async void FunctionsWithCardinalityMany(string functionName, string parameterType, string dataType)
public async Task FunctionsWithCardinalityMany(string functionName, string parameterType, string dataType)
{
StringBuilder inputCodeBuilder = new StringBuilder();
inputCodeBuilder.Append(_usingStringsForInput);
Expand Down Expand Up @@ -297,7 +298,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void EnumerableGenericInputFunction(LanguageVersion languageVersion)
public async Task EnumerableGenericInputFunction(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down Expand Up @@ -401,7 +402,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void EnumerableStringClassesAsInputFunctions(LanguageVersion languageVersion)
public async Task EnumerableStringClassesAsInputFunctions(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down Expand Up @@ -592,7 +593,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void EnumerableBinaryClassesAsInputFunctions(LanguageVersion languageVersion)
public async Task EnumerableBinaryClassesAsInputFunctions(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down Expand Up @@ -733,7 +734,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void PocoInputFunctions(LanguageVersion languageVersion)
public async Task PocoInputFunctions(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down Expand Up @@ -861,7 +862,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void CardinalityManyWithNonIterableInputFails(LanguageVersion languageVersion)
public async Task CardinalityManyWithNonIterableInputFails(LanguageVersion languageVersion)
{
var inputCode = @"using System;
using System.Net;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void BasicHttpFunctionWithNoResponse(LanguageVersion languageVersion)
public async Task BasicHttpFunctionWithNoResponse(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down Expand Up @@ -248,7 +248,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void ReturnTypeJustHttp(LanguageVersion languageVersion)
public async Task ReturnTypeJustHttp(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down Expand Up @@ -361,7 +361,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void NonStaticVoidOrTaskReturnType(LanguageVersion languageVersion)
public async Task NonStaticVoidOrTaskReturnType(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(

[Theory]
[InlineData(LanguageVersion.Latest)]
public async void FunctionsMultipleOutputBindingWithActionResult(LanguageVersion languageVersion)
public async Task FunctionsMultipleOutputBindingWithActionResult(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down Expand Up @@ -565,7 +565,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
}

[Fact]
public async void FunctionWithTaskReturnType()
public async Task FunctionWithTaskReturnType()
{
string inputCode = """
using System;
Expand Down Expand Up @@ -660,7 +660,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
}

[Fact]
public async void FunctionWithGenericTaskReturnType()
public async Task FunctionWithGenericTaskReturnType()
{
string inputCode = """
using System;
Expand Down Expand Up @@ -893,7 +893,7 @@ await TestHelpers.RunTestAsync<FunctionMetadataProviderGenerator>(
[InlineData(LanguageVersion.CSharp10)]
[InlineData(LanguageVersion.CSharp11)]
[InlineData(LanguageVersion.Latest)]
public async void HttpTriggerVoidOrTaskReturnType(LanguageVersion languageVersion)
public async Task HttpTriggerVoidOrTaskReturnType(LanguageVersion languageVersion)
{
string inputCode = """
using System;
Expand Down
Loading

0 comments on commit 2607d23

Please sign in to comment.