Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup--tests #29030

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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