Skip to content

Commit

Permalink
Fix Http Results test to respond to dotnet/runtime#87093
Browse files Browse the repository at this point in the history
  • Loading branch information
eerhardt committed Jun 7, 2023
1 parent ba05754 commit ce55119
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Http/Http.Results/test/ResultsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,15 +1009,15 @@ public void Json_WithNullSerializerContext_ThrowsArgException()
[Fact]
public void Json_WithInvalidSerializerContext_ThrowsInvalidOperationException()
{
var ex = Assert.Throws<InvalidOperationException>(() => Results.Json(null, type: typeof(object), context: StringJsonContext.Default));
Assert.Equal(ex.Message, $"Unable to obtain the JsonTypeInfo for type 'System.Object' from the context '{typeof(StringJsonContext).FullName}'.");
var ex = Assert.Throws<InvalidOperationException>(() => Results.Json(null, type: typeof(Todo), context: StringJsonContext.Default));
Assert.Equal(ex.Message, $"Unable to obtain the JsonTypeInfo for type 'Microsoft.AspNetCore.Http.HttpResults.ResultsTests+Todo' from the context '{typeof(StringJsonContext).FullName}'.");
}

[Fact]
public void JsonOfT_WithInvalidSerializerContext_ThrowsInvalidOperationException()
{
var ex = Assert.Throws<InvalidOperationException>(() => Results.Json<object>(null, context: StringJsonContext.Default));
Assert.Equal(ex.Message, $"Unable to obtain the JsonTypeInfo for type 'System.Object' from the context '{typeof(StringJsonContext).FullName}'.");
var ex = Assert.Throws<InvalidOperationException>(() => Results.Json<Todo>(null, context: StringJsonContext.Default));
Assert.Equal(ex.Message, $"Unable to obtain the JsonTypeInfo for type 'Microsoft.AspNetCore.Http.HttpResults.ResultsTests+Todo' from the context '{typeof(StringJsonContext).FullName}'.");
}

[Fact]
Expand Down

0 comments on commit ce55119

Please sign in to comment.