Which version of Microsoft.IdentityModel are you using?
Microsoft.IdentityModel 8.6.0
Where is the issue?
Is this a new or an existing app?
The app is in production and I have upgraded to a new version of Microsoft.IdentityModel.
Repro
While fixing issue #3130, I identified that some test data in WriteKeyInfoTheoryData is incorrect, leading to mismatches between the actual and expected results in the WriteKeyInfo test method in the DSigSerializerTests class inside the Microsoft.IdentityModel.Xml.Tests test project.
Code Snippet
[Theory, MemberData(nameof(WriteKeyInfoTheoryData), DisableDiscoveryEnumeration = true)]
public void WriteKeyInfo(DSigSerializerTheoryData theoryData)
{
TestUtilities.WriteHeader($"{this}.WriteKeyInfo", theoryData);
var context = new CompareContext($"{this}.WriteKeyInfo, {theoryData.TestId}");
try
{
var keyInfo = theoryData.Serializer.ReadKeyInfo(XmlUtilities.CreateDictionaryReader(theoryData.Xml));
theoryData.ExpectedException.ProcessNoException(context.Diffs);
IdentityComparer.AreKeyInfosEqual(keyInfo, theoryData.KeyInfo, context);
var ms = new MemoryStream();
var writer = XmlDictionaryWriter.CreateTextWriter(ms);
theoryData.Serializer.WriteKeyInfo(writer, keyInfo);
writer.Flush();
var xml = Encoding.UTF8.GetString(ms.ToArray());
// FIXME: Test data needs to be corrected because the test data and expected results differ.
// Used CompareContext.Default to prevent this test from failing.
IdentityComparer.AreEqual(theoryData.Xml, xml, CompareContext.Default);
}
catch (Exception ex)
{
theoryData.ExpectedException.ProcessException(ex, context.Diffs);
}
TestUtilities.AssertFailIfErrors(context);
}
Expected behavior
The test should correctly compare the serialized XML output with the expected XML structure. The test data in WriteKeyInfoTheoryData should align with the actual expected results.
Actual behavior
Currently, the test data and expected results do not match, which forces the test to use CompareContext.Default to avoid failure. This indicates that the test data needs to be updated for accurate validation.
Possible solution
- Review and update the test data in
WriteKeyInfoTheoryData to ensure consistency with the expected serialized XML output.
- Remove reliance on
CompareContext.Default and use created context to validate the XML structure against the corrected expected results.
Additional context / logs / screenshots / links to code
Which version of Microsoft.IdentityModel are you using?
Microsoft.IdentityModel 8.6.0
Where is the issue?
Is this a new or an existing app?
The app is in production and I have upgraded to a new version of
Microsoft.IdentityModel.Repro
While fixing issue #3130, I identified that some test data in
WriteKeyInfoTheoryDatais incorrect, leading to mismatches between the actual and expected results in theWriteKeyInfotest method in theDSigSerializerTestsclass inside the Microsoft.IdentityModel.Xml.Tests test project.Code Snippet
Expected behavior
The test should correctly compare the serialized XML output with the expected XML structure. The test data in
WriteKeyInfoTheoryDatashould align with the actual expected results.Actual behavior
Currently, the test data and expected results do not match, which forces the test to use
CompareContext.Defaultto avoid failure. This indicates that the test data needs to be updated for accurate validation.Possible solution
WriteKeyInfoTheoryDatato ensure consistency with the expected serialized XML output.CompareContext.Defaultand use created context to validate the XML structure against the corrected expected results.Additional context / logs / screenshots / links to code
Microsoft.IdentityModel.Xml.TestsunderDSigSerializerTests.cs.WriteKeyInfoTheoryData.