-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Adding Unit Tests for XmlFormatters with DeclaredType as object. #1143
Conversation
|
||
[Theory] | ||
[MemberData(nameof(BasicTypeValues))] | ||
public async Task XmlDataContractSerializerOutputFormatterCanWriteBasicTypes(object input, string expectedOutput) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test CanWriteResult
and GetSupportedContentTypes
as well as WriteAsync
When @rynowak is happy |
530c909
to
20698c3
Compare
Updated.. |
|
||
// Act | ||
var resultArray = formatter.GetSupportedContentTypes( | ||
typeof(DummyClass), typeof(DummyClass), MediaTypeHeaderValue.Parse("application/xml")).AsArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't test the difference between declaredType and runtimeType, which is what this bug is about
⌚ Discussed with Sorna in person, he's also going to add tests for #1081 to this PR |
Updated.. I separated the #1081 PR.. |
4ecd5a9
to
ea7af0d
Compare
// Assert | ||
if (expectedOutput != null) | ||
{ | ||
Assert.Equal(expectedOutput, (result.AsArray())[0].RawValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert.Equal(expectedOutput, Assert.Single(result).RawValue);
much clearer and validates something else that you care about
cleanup asserts and then |
Done. Thanks Ryan! Checked in - 96318dc |
Issue #1072