Skip to content

Commit 7824f5a

Browse files
committed
Fixed all failing tests after updating ASP.NET Core to version 5.0
1 parent dafbd0e commit 7824f5a

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

src/MyTested.AspNetCore.Mvc.Abstractions/Internal/Application/TestApplicationStartupLoader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ private static void PrepareStartup(IServiceCollection serviceCollection)
116116
startupMethods = startupLoader.LoadMethods(
117117
serviceCollection.BuildServiceProviderFromFactory(),
118118
StartupType,
119-
TestWebServer.Environment.EnvironmentName);
119+
TestWebServer.Environment.EnvironmentName,
120+
null);
120121

121122
if (typeof(IStartup).GetTypeInfo().IsAssignableFrom(StartupType.GetTypeInfo()))
122123
{

src/MyTested.AspNetCore.Mvc.Abstractions/Internal/TestFramework.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
public static class TestFramework
88
{
99
public const string TestFrameworkName = "MyTested.AspNetCore.Mvc";
10-
public const string ReleaseDate = "2019-12-12";
11-
public const string VersionPrefix = "3.1";
10+
public const string ReleaseDate = "2021-07-01";
11+
public const string VersionPrefix = "5.0";
1212

1313
internal static void EnsureCorrectVersion(DependencyContext dependencyContext)
1414
{

src/MyTested.AspNetCore.Mvc.Abstractions/Utilities/ExposedObject.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,22 @@ public override bool TryGetMember(GetMemberBinder binder, out object result)
7979
return base.TryGetMember(binder, out result);
8080
}
8181

82-
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
82+
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] arguments, out object result)
8383
{
84-
args = args
84+
arguments = arguments
8585
.Select(a => Unwrap(a))
8686
.ToArray();
8787

88-
var method = this.type.GetMethod(binder.Name, args.Select(a => a.GetType()).ToArray());
88+
var argumentsTypes = arguments
89+
.Select(a => a?.GetType() ?? typeof(object))
90+
.ToArray();
91+
92+
var method = this.type.GetMethod(binder.Name, argumentsTypes);
8993

9094
try
9195
{
9296
result = method
93-
.Invoke(this.instance, args)
97+
.Invoke(this.instance, arguments)
9498
.Exposed();
9599
}
96100
catch (Exception ex)

test/MyTested.AspNetCore.Mvc.NewtonsoftJson.Test/BuildersTests/ActionResultsTests/JsonTests/JsonSerializerTestBuilderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void WithCultureShouldThrowExceptionWithIncorrectValue()
109109
.WithJsonSerializerSettings(s =>
110110
s.WithCulture(CultureInfo.GetCultureInfo("en-US"))));
111111
},
112-
"When calling JsonWithSettingsAction action in MvcController expected JSON result serializer settings to have 'English (United States)' culture, but in fact found 'Invariant Language (Invariant Country)'.");
112+
"When calling JsonWithSettingsAction action in MvcController expected JSON result serializer settings to have 'English (United States)' culture, but in fact found 'Unknown language'.");
113113
}
114114

115115
[Fact]

test/MyTested.AspNetCore.Mvc.ViewData.Test/PluginsTests/ViewDataTestPluginTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public void ShouldInvokeMethodOfTypeVoidWithValidServiceCollection()
3333

3434
testPlugin.DefaultServiceRegistrationDelegate(serviceCollection);
3535

36-
Assert.True(serviceCollection.Count == 157); }
36+
Assert.True(serviceCollection.Count == 160);
37+
}
3738
}
3839
}

0 commit comments

Comments
 (0)