public void ReadKeyInfo(DSigSerializerTheoryData theoryData) { TestUtilities.WriteHeader($"{this}.ReadKeyInfo", theoryData); var context = new CompareContext($"{this}.ReadKeyInfo, {theoryData.TestId}"); try { var keyInfo = theoryData.Serializer.ReadKeyInfo(XmlUtilities.CreateDictionaryReader(theoryData.Xml)); theoryData.ExpectedException.ProcessNoException(context.Diffs); IdentityComparer.AreKeyInfosEqual(keyInfo, theoryData.KeyInfo, context); // make sure we write and then read // as we only support partial elements, the KeyInfo's cannot be compared var ms = new MemoryStream(); var writer = XmlDictionaryWriter.CreateTextWriter(ms); theoryData.Serializer.WriteKeyInfo(writer, keyInfo); writer.Flush(); var xml = Encoding.UTF8.GetString(ms.ToArray()); theoryData.Serializer.ReadKeyInfo(XmlUtilities.CreateDictionaryReader(xml)); } catch (Exception ex) { theoryData.ExpectedException.ProcessException(ex, context.Diffs); } TestUtilities.AssertFailIfErrors(context); }