Skip to content

Commit

Permalink
Code cleanup--tests (#29030)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Sep 9, 2022
1 parent edae9ff commit 6c116b7
Show file tree
Hide file tree
Showing 327 changed files with 18,079 additions and 17,262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Text;
using Microsoft.Extensions.DependencyModel;
using CompilationOptions = Microsoft.CodeAnalysis.CompilationOptions;

namespace Microsoft.EntityFrameworkCore.TestUtilities;

Expand All @@ -27,7 +26,9 @@ protected async Task AssertNoDiagnostics(string source, params string[] extraUsi
=> GetDiagnosticsAsync(source, analyzerDiagnosticsOnly: true, extraUsings);

protected virtual async Task<(Diagnostic[], string)> GetDiagnosticsAsync(
string source, bool analyzerDiagnosticsOnly, params string[] extraUsings)
string source,
bool analyzerDiagnosticsOnly,
params string[] extraUsings)
{
var sb = new StringBuilder();
foreach (var @using in _usings.Concat(extraUsings))
Expand Down Expand Up @@ -60,9 +61,10 @@ protected async Task<Diagnostic[]> GetDiagnosticsFullSourceAsync(string source,
var analyzer = CreateDiagnosticAnalyzer();
var compilationWithAnalyzers
= compilation
.WithAnalyzers(ImmutableArray.Create(analyzer),
.WithAnalyzers(
ImmutableArray.Create(analyzer),
new CompilationWithAnalyzersOptions(
new AnalyzerOptions(new()),
new AnalyzerOptions(new ImmutableArray<AdditionalText>()),
onAnalyzerException: null,
concurrentAnalysis: false,
logAnalyzerExecutionTime: false,
Expand Down Expand Up @@ -102,10 +104,7 @@ var metadataReferences
.WithCompilationOptions(
new CSharpCompilationOptions(
OutputKind.DynamicallyLinkedLibrary,
specificDiagnosticOptions: new Dictionary<string, ReportDiagnostic>
{
{ "CS1701", ReportDiagnostic.Suppress }
},
specificDiagnosticOptions: new Dictionary<string, ReportDiagnostic> { { "CS1701", ReportDiagnostic.Suppress } },
nullableContextOptions: NullableContextOptions.Enable));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ protected ConfigurationDbContextTestBase(ConfigurationDbContextFixtureBase fixtu

protected ConfigurationDbContextFixtureBase Fixture { get; }

[ConditionalFact(Skip = "VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
[ConditionalFact(
Skip =
"VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
public async Task Can_call_ResourceStore_FindApiScopesByNameAsync()
=> await ExecuteWithStrategyInTransactionAsync(
async context =>
Expand Down Expand Up @@ -70,7 +72,9 @@ private static async Task SaveApiScopes(ConfigurationDbContext context)
await context.SaveChangesAsync();
}

[ConditionalFact(Skip = "VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
[ConditionalFact(
Skip =
"VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
public async Task Can_call_ClientStore_FindClientByIdAsync()
=> await ExecuteWithStrategyInTransactionAsync(
async context =>
Expand Down Expand Up @@ -99,7 +103,9 @@ public async Task Can_call_ClientStore_FindClientByIdAsync()
}
);

[ConditionalFact(Skip = "VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
[ConditionalFact(
Skip =
"VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
public async Task Can_call_ResourceStore_FindIdentityResourcesByScopeNameAsync()
=> await ExecuteWithStrategyInTransactionAsync(
async context =>
Expand All @@ -115,7 +121,9 @@ public async Task Can_call_ResourceStore_FindIdentityResourcesByScopeNameAsync()
}
);

[ConditionalFact(Skip = "VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
[ConditionalFact(
Skip =
"VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
public async Task Can_call_ResourceStore_FindApiResourcesByScopeNameAsync()
=> await ExecuteWithStrategyInTransactionAsync(
async context =>
Expand All @@ -130,7 +138,9 @@ public async Task Can_call_ResourceStore_FindApiResourcesByScopeNameAsync()
}
);

[ConditionalFact(Skip = "VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
[ConditionalFact(
Skip =
"VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
public async Task Can_call_ResourceStore_GetAllResourcesAsync()
=> await ExecuteWithStrategyInTransactionAsync(
async context =>
Expand Down Expand Up @@ -209,7 +219,9 @@ private static async Task SaveApiResources(ConfigurationDbContext context)
await context.SaveChangesAsync();
}

[ConditionalFact(Skip = "VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
[ConditionalFact(
Skip =
"VerificationException : Method System.Linq.Enumerable.MaxFloat: type argument 'System.Char' violates the constraint of type parameter 'T'.")]
public async Task Can_call_ResourceStore_FindApiResourcesByNameAsync()
=> await ExecuteWithStrategyInTransactionAsync(
async context =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.



// Skip the entire assembly if not on Windows and no external SQL Server is configured

[assembly: SqlServerConfiguredCondition]
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public async Task Should_throw_if_specified_region_is_wrong()
context.SaveChanges();
});

Assert.Equal("ApplicationRegion configuration 'FakeRegion' is not a valid Azure region or the current SDK version does not recognize it. If the value represents a valid region, make sure you are using the latest SDK version.", exception.Message);
Assert.Equal(
"ApplicationRegion configuration 'FakeRegion' is not a valid Azure region or the current SDK version does not recognize it. If the value represents a valid region, make sure you are using the latest SDK version.",
exception.Message);
}

[ConditionalFact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.



// Skip the entire assembly if cannot connect to CosmosDb

[assembly: CosmosDbConfiguredCondition]

// Waiting on Task causes deadlocks when run in parallel
Expand Down
Loading

0 comments on commit 6c116b7

Please sign in to comment.