Merge branch 'develop' into tilee/aspnetcore_dependencies
This commit is contained in:
Коммит
2582b3a174
|
@ -1,4 +1,4 @@
|
|||
#if !NET452 && !NET46
|
||||
#if !NET452 && !NET46 && !REDFIELD
|
||||
namespace Microsoft.ApplicationInsights.TestFramework.Extensibility.Implementation.Authentication
|
||||
{
|
||||
using System;
|
||||
|
@ -302,7 +302,7 @@ namespace Microsoft.ApplicationInsights.TestFramework.Extensibility.Implementati
|
|||
var test = compiledExpression2.DynamicInvoke(objAccessToken);
|
||||
|
||||
}
|
||||
#region TestClasses
|
||||
#region TestClasses
|
||||
|
||||
/// <summary>
|
||||
/// This class inherits <see cref="MockCredential"/> which inherits <see cref="Azure.Core.TokenCredential"/>.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if !NET452 && !NET46
|
||||
#if !NET452 && !NET46 && !REDFIELD
|
||||
namespace Microsoft.ApplicationInsights.TestFramework.Extensibility.Implementation.Authentication
|
||||
{
|
||||
using System;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if !NET452 && !NET46
|
||||
#if !NET452 && !NET46 && !REDFIELD
|
||||
namespace Microsoft.ApplicationInsights.TestFramework.Extensibility.Implementation.Authentication
|
||||
{
|
||||
using System;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if !NET452 && !NET46
|
||||
#if !NET452 && !NET46 && !REDFIELD
|
||||
namespace Microsoft.ApplicationInsights.TestFramework.Implementation
|
||||
{
|
||||
using Microsoft.ApplicationInsights.Channel;
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
/// </remarks>
|
||||
internal class ReflectionCredentialEnvelope : CredentialEnvelope
|
||||
{
|
||||
#if REDFIELD
|
||||
private static volatile string azureCoreAssemblyName = "Azure.Identity.ILRepack";
|
||||
#else
|
||||
private static volatile string azureCoreAssemblyName = "Azure.Core";
|
||||
#endif
|
||||
|
||||
private readonly object tokenCredential;
|
||||
private readonly object tokenRequestContext;
|
||||
|
||||
|
@ -102,8 +108,7 @@
|
|||
/// </returns>
|
||||
private static Type GetTokenCredentialType()
|
||||
{
|
||||
var typeName = "Azure.Core.TokenCredential, Azure.Core";
|
||||
var assemblyName = "Azure.Core";
|
||||
var typeName = $"Azure.Core.TokenCredential, {azureCoreAssemblyName}";
|
||||
|
||||
Type typeTokenCredential = null;
|
||||
|
||||
|
@ -118,7 +123,7 @@
|
|||
|
||||
if (typeTokenCredential == null)
|
||||
{
|
||||
if (AppDomain.CurrentDomain.GetAssemblies().Any(x => x.FullName.StartsWith(assemblyName)))
|
||||
if (AppDomain.CurrentDomain.GetAssemblies().Any(x => x.FullName.StartsWith(azureCoreAssemblyName)))
|
||||
{
|
||||
throw new Exception("An unknown error has occurred. Failed to get type Azure.Core.TokenCredential. Detected that Azure.Core is loaded in AppDomain.CurrentDomain.");
|
||||
}
|
||||
|
@ -169,7 +174,7 @@
|
|||
internal static object MakeTokenRequestContext(string[] scopes)
|
||||
{
|
||||
return Activator.CreateInstance(
|
||||
type: Type.GetType("Azure.Core.TokenRequestContext, Azure.Core"),
|
||||
type: Type.GetType($"Azure.Core.TokenRequestContext, {azureCoreAssemblyName}"),
|
||||
args: new object[] { scopes, null, });
|
||||
}
|
||||
|
||||
|
@ -183,7 +188,7 @@
|
|||
/// </returns>
|
||||
private static Delegate BuildDelegateAccessTokenToAuthToken()
|
||||
{
|
||||
Type typeAccessToken = Type.GetType("Azure.Core.AccessToken, Azure.Core");
|
||||
Type typeAccessToken = Type.GetType($"Azure.Core.AccessToken, {azureCoreAssemblyName}");
|
||||
|
||||
var parameterExpression_AccessToken = Expression.Parameter(typeAccessToken, "parameterExpression_AccessToken");
|
||||
|
||||
|
@ -218,8 +223,8 @@
|
|||
/// </returns>
|
||||
private static Delegate BuildDelegateGetToken()
|
||||
{
|
||||
Type typeTokenCredential = Type.GetType("Azure.Core.TokenCredential, Azure.Core");
|
||||
Type typeTokenRequestContext = Type.GetType("Azure.Core.TokenRequestContext, Azure.Core");
|
||||
Type typeTokenCredential = Type.GetType($"Azure.Core.TokenCredential, {azureCoreAssemblyName}");
|
||||
Type typeTokenRequestContext = Type.GetType($"Azure.Core.TokenRequestContext, {azureCoreAssemblyName}");
|
||||
Type typeCancellationToken = typeof(CancellationToken);
|
||||
|
||||
var parameterExpression_tokenCredential = Expression.Parameter(type: typeTokenCredential, name: "parameterExpression_TokenCredential");
|
||||
|
@ -255,8 +260,8 @@
|
|||
/// </returns>
|
||||
private static Delegate BuildDelegateGetTokenAsync()
|
||||
{
|
||||
Type typeTokenCredential = Type.GetType("Azure.Core.TokenCredential, Azure.Core");
|
||||
Type typeTokenRequestContext = Type.GetType("Azure.Core.TokenRequestContext, Azure.Core");
|
||||
Type typeTokenCredential = Type.GetType($"Azure.Core.TokenCredential, {azureCoreAssemblyName}");
|
||||
Type typeTokenRequestContext = Type.GetType($"Azure.Core.TokenRequestContext, {azureCoreAssemblyName}");
|
||||
Type typeCancellationToken = typeof(CancellationToken);
|
||||
|
||||
var parameterExpression_TokenCredential = Expression.Parameter(type: typeTokenCredential, name: "parameterExpression_TokenCredential");
|
||||
|
@ -297,8 +302,8 @@
|
|||
/// </returns>
|
||||
private static Delegate BuildGetTaskResult()
|
||||
{
|
||||
Type typeTokenCredential = Type.GetType("Azure.Core.TokenCredential, Azure.Core");
|
||||
Type typeTokenRequestContext = Type.GetType("Azure.Core.TokenRequestContext, Azure.Core");
|
||||
Type typeTokenCredential = Type.GetType($"Azure.Core.TokenCredential, {azureCoreAssemblyName}");
|
||||
Type typeTokenRequestContext = Type.GetType($"Azure.Core.TokenRequestContext, {azureCoreAssemblyName}");
|
||||
Type typeCancellationToken = typeof(CancellationToken);
|
||||
var methodInfo_GetTokenAsync = typeTokenCredential.GetMethod(name: "GetTokenAsync", types: new Type[] { typeTokenRequestContext, typeCancellationToken });
|
||||
var methodInfo_AsTask = methodInfo_GetTokenAsync.ReturnType.GetMethod("AsTask");
|
||||
|
|
|
@ -12,34 +12,13 @@ using Xunit.Abstractions;
|
|||
|
||||
namespace IntegrationTests.Tests
|
||||
{
|
||||
public partial class RequestCollectionTest :
|
||||
#if NET5_0
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_net_5_0>>
|
||||
#elif NETCOREAPP3_1
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_netcoreapp_3_1>>
|
||||
#else
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_netcoreapp_2_1>>
|
||||
#endif
|
||||
public partial class RequestCollectionTest : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||
{
|
||||
#if NET5_0
|
||||
private readonly CustomWebApplicationFactory<Startup_net_5_0> _factory;
|
||||
#elif NETCOREAPP3_1
|
||||
private readonly CustomWebApplicationFactory<Startup_netcoreapp_3_1> _factory;
|
||||
#else
|
||||
private readonly CustomWebApplicationFactory<Startup_netcoreapp_2_1> _factory;
|
||||
#endif
|
||||
private readonly CustomWebApplicationFactory<Startup> _factory;
|
||||
|
||||
protected readonly ITestOutputHelper output;
|
||||
|
||||
public RequestCollectionTest(CustomWebApplicationFactory<
|
||||
#if NET5_0
|
||||
Startup_net_5_0
|
||||
#elif NETCOREAPP3_1
|
||||
Startup_netcoreapp_3_1
|
||||
#else
|
||||
Startup_netcoreapp_2_1
|
||||
#endif
|
||||
> factory, ITestOutputHelper output)
|
||||
public RequestCollectionTest(CustomWebApplicationFactory<Startup> factory, ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
_factory = factory;
|
||||
|
|
|
@ -13,14 +13,7 @@ using IntegrationTests.WebApp;
|
|||
|
||||
namespace IntegrationTests.Tests
|
||||
{
|
||||
public partial class RequestCollectionTest :
|
||||
#if NET5_0
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_net_5_0>>
|
||||
#elif NETCOREAPP3_1
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_netcoreapp_3_1>>
|
||||
#else
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_netcoreapp_2_1>>
|
||||
#endif
|
||||
public partial class RequestCollectionTest : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestSuccessWithTraceParent()
|
||||
|
|
|
@ -17,14 +17,7 @@ using IntegrationTests.WebApp;
|
|||
|
||||
namespace IntegrationTests.Tests
|
||||
{
|
||||
public partial class RequestCollectionTest :
|
||||
#if NET5_0
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_net_5_0>>
|
||||
#elif NETCOREAPP3_1
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_netcoreapp_3_1>>
|
||||
#else
|
||||
IClassFixture<CustomWebApplicationFactory<Startup_netcoreapp_2_1>>
|
||||
#endif
|
||||
public partial class RequestCollectionTest : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestILoggerUserConfigOverRidesDefaultLevel()
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace IntegrationTests.WebApp
|
|||
{
|
||||
public class Program
|
||||
{
|
||||
#if NET5_0
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
|
@ -23,20 +22,7 @@ namespace IntegrationTests.WebApp
|
|||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup_net_5_0>();
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
#else
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup_netcoreapp_3_1>();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ using Microsoft.Extensions.Hosting;
|
|||
|
||||
namespace IntegrationTests.WebApp
|
||||
{
|
||||
public class Startup_net_5_0
|
||||
public partial class Startup
|
||||
{
|
||||
public Startup_net_5_0(IConfiguration configuration)
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ using Microsoft.Extensions.Hosting;
|
|||
|
||||
namespace IntegrationTests.WebApp
|
||||
{
|
||||
public class Startup_netcoreapp_3_1
|
||||
public partial class Startup
|
||||
{
|
||||
public Startup_netcoreapp_3_1(IConfiguration configuration)
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче