Upgrade test framework versions and fix test issues
This commit is contained in:
parent
eedcca1be9
commit
7199e8d358
|
|
@ -4,7 +4,7 @@
|
||||||
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
|
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
|
||||||
<MoqVersion>4.7.1</MoqVersion>
|
<MoqVersion>4.7.1</MoqVersion>
|
||||||
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
|
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
|
||||||
<TestSdkVersion>15.0.0</TestSdkVersion>
|
<TestSdkVersion>15.3.0-*</TestSdkVersion>
|
||||||
<XunitVersion>2.2.0</XunitVersion>
|
<XunitVersion>2.3.0-beta2-*</XunitVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,4 @@
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,4 @@
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,4 @@
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,4 @@
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ namespace Microsoft.Extensions.Internal.Test
|
||||||
public static TheoryData CanGetStackTraceData => new TheoryData<Action, string>
|
public static TheoryData CanGetStackTraceData => new TheoryData<Action, string>
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
ThrowsException,
|
TestMethods.ThrowsException,
|
||||||
$"{typeof(StackTraceTest).GetTypeInfo().FullName}.{nameof(ThrowsException)}()"
|
$"{typeof(TestMethods).GetTypeInfo().FullName}.{nameof(TestMethods.ThrowsException)}()"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
new ExceptionType().MethodThatThrows,
|
new ExceptionType().MethodThatThrows,
|
||||||
|
|
@ -84,19 +84,18 @@ namespace Microsoft.Extensions.Internal.Test
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var thisType = typeof(StackTraceTest);
|
|
||||||
var intParse = ((Func<string, int>)int.Parse).GetMethodInfo();
|
var intParse = ((Func<string, int>)int.Parse).GetMethodInfo();
|
||||||
var dateTimeOffsetTryParse = typeof(DateTimeOffset).GetMethods()
|
var dateTimeOffsetTryParse = typeof(DateTimeOffset).GetMethods()
|
||||||
.First(m => m.Name == nameof(DateTimeOffset.TryParse) && m.GetParameters().Length == 2);
|
.First(m => m.Name == nameof(DateTimeOffset.TryParse) && m.GetParameters().Length == 2);
|
||||||
var genericTypeMethod = typeof(List<Process>).GetMethod(nameof(List<Process>.Remove));
|
var genericTypeMethod = typeof(List<Process>).GetMethod(nameof(List<Process>.Remove));
|
||||||
var genericMethod = thisType.GetMethod(nameof(GenericMethod));
|
var genericMethod = typeof(TestMethods).GetMethod(nameof(TestMethods.GenericMethod));
|
||||||
var multiGenericMethod = thisType.GetMethod(nameof(MultiParameterGenericMethod));
|
var multiGenericMethod = typeof(TestMethods).GetMethod(nameof(TestMethods.MultiParameterGenericMethod));
|
||||||
var byRefMethod = thisType.GetMethod(nameof(ByRefMethod));
|
var byRefMethod = typeof(TestMethods).GetMethod(nameof(TestMethods.ByRefMethod));
|
||||||
var asyncMethod = thisType.GetMethod(nameof(AsyncMethod));
|
var asyncMethod = typeof(TestMethods).GetMethod(nameof(TestMethods.AsyncMethod));
|
||||||
var nullableParam = thisType.GetMethod(nameof(MethodWithNullableParams));
|
var nullableParam = typeof(TestMethods).GetMethod(nameof(TestMethods.MethodWithNullableParams));
|
||||||
var nestedMethod = thisType.GetNestedType(nameof(NestedType), BindingFlags.Public)
|
var nestedMethod = typeof(StackTraceTest).GetNestedType(nameof(NestedType), BindingFlags.Public)
|
||||||
.GetMethod(nameof(NestedType.NestedMethod));
|
.GetMethod(nameof(NestedType.NestedMethod));
|
||||||
var nestedGenericMethod = thisType.GetNestedType(nameof(NestedType), BindingFlags.Public)
|
var nestedGenericMethod = typeof(StackTraceTest).GetNestedType(nameof(NestedType), BindingFlags.Public)
|
||||||
.GetMethod(nameof(NestedType.NestedGenericMethod));
|
.GetMethod(nameof(NestedType.NestedGenericMethod));
|
||||||
|
|
||||||
return new TheoryData<MethodBase, string>
|
return new TheoryData<MethodBase, string>
|
||||||
|
|
@ -104,11 +103,11 @@ namespace Microsoft.Extensions.Internal.Test
|
||||||
{ intParse, "int.Parse(string s)" },
|
{ intParse, "int.Parse(string s)" },
|
||||||
{ dateTimeOffsetTryParse, "System.DateTimeOffset.TryParse(string input, out DateTimeOffset result)" },
|
{ dateTimeOffsetTryParse, "System.DateTimeOffset.TryParse(string input, out DateTimeOffset result)" },
|
||||||
{ genericTypeMethod, "System.Collections.Generic.List<System.Diagnostics.Process>.Remove(Process item)" },
|
{ genericTypeMethod, "System.Collections.Generic.List<System.Diagnostics.Process>.Remove(Process item)" },
|
||||||
{ genericMethod, $"{thisType}.{nameof(GenericMethod)}<TVal>(TVal value)" },
|
{ genericMethod, $"{typeof(TestMethods)}.{nameof(TestMethods.GenericMethod)}<TVal>(TVal value)" },
|
||||||
{ multiGenericMethod, $"{thisType}.{nameof(MultiParameterGenericMethod)}<TKey, TVal>(KeyValuePair<TKey, TVal> keyValuePair)" },
|
{ multiGenericMethod, $"{typeof(TestMethods)}.{nameof(TestMethods.MultiParameterGenericMethod)}<TKey, TVal>(KeyValuePair<TKey, TVal> keyValuePair)" },
|
||||||
{ byRefMethod, $"{thisType}.{nameof(ByRefMethod)}(int a, CultureInfo b, ref long c)" },
|
{ byRefMethod, $"{typeof(TestMethods)}.{nameof(TestMethods.ByRefMethod)}(int a, CultureInfo b, ref long c)" },
|
||||||
{ asyncMethod, $"{thisType}.{nameof(AsyncMethod)}(string name)" },
|
{ asyncMethod, $"{typeof(TestMethods)}.{nameof(TestMethods.AsyncMethod)}(string name)" },
|
||||||
{ nullableParam, $"{thisType}.{nameof(MethodWithNullableParams)}(Nullable<int> name, string value)" },
|
{ nullableParam, $"{typeof(TestMethods)}.{nameof(TestMethods.MethodWithNullableParams)}(Nullable<int> name, string value)" },
|
||||||
{ nestedMethod, $"{typeof(NestedType)}.{nameof(NestedType.NestedMethod)}(string value)" },
|
{ nestedMethod, $"{typeof(NestedType)}.{nameof(NestedType.NestedMethod)}(string value)" },
|
||||||
{ nestedGenericMethod, $"{typeof(NestedType)}.{nameof(NestedType.NestedGenericMethod)}<TKey>(NestedParameterType a, TKey key)" }
|
{ nestedGenericMethod, $"{typeof(NestedType)}.{nameof(NestedType.NestedGenericMethod)}<TKey>(NestedParameterType a, TKey key)" }
|
||||||
};
|
};
|
||||||
|
|
@ -126,23 +125,26 @@ namespace Microsoft.Extensions.Internal.Test
|
||||||
Assert.Equal(expected, actual.ToString());
|
Assert.Equal(expected, actual.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ThrowsException()
|
public class TestMethods
|
||||||
{
|
{
|
||||||
throw new Exception();
|
public static void ThrowsException()
|
||||||
}
|
{
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
public string GenericMethod<TVal>(TVal value) => value.ToString();
|
public string GenericMethod<TVal>(TVal value) => value.ToString();
|
||||||
|
|
||||||
public void MultiParameterGenericMethod<TKey, TVal>(KeyValuePair<TKey, TVal> keyValuePair)
|
public void MultiParameterGenericMethod<TKey, TVal>(KeyValuePair<TKey, TVal> keyValuePair)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public decimal ByRefMethod(int a, CultureInfo b, ref long c) => a + c;
|
public decimal ByRefMethod(int a, CultureInfo b, ref long c) => a + c;
|
||||||
|
|
||||||
public async Task<object> AsyncMethod(string name) => await Task.FromResult(0);
|
public async Task<object> AsyncMethod(string name) => await Task.FromResult(0);
|
||||||
|
|
||||||
public void MethodWithNullableParams(int? name, string value)
|
public void MethodWithNullableParams(int? name, string value)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NestedType
|
public class NestedType
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,4 @@
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue