test(wxapi): 增加 AES-CBC 解密的单元测试用例

This commit is contained in:
Fu Diwei
2021-10-19 15:09:05 +08:00
parent 3afb92828c
commit d3513dbc46
5 changed files with 77 additions and 21 deletions

View File

@@ -11,18 +11,19 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Utilities
internal static class XmlUtility
{
// REF: https://docs.microsoft.com/zh-cn/dotnet/api/system.xml.serialization.xmlserializer#dynamically-generated-assemblies
private static Hashtable _serializers = new Hashtable();
private static readonly Hashtable _xmlSerializers = new Hashtable();
private static readonly XmlRootAttribute _xmlRoot = new XmlRootAttribute("xml");
private static XmlSerializer GetTypedSerializer(Type type)
{
if (type == null) throw new ArgumentNullException(nameof(type));
string skey = type.AssemblyQualifiedName ?? type.GetHashCode().ToString();
XmlSerializer? xmlSerializer = (XmlSerializer?)_serializers[skey];
XmlSerializer? xmlSerializer = (XmlSerializer?)_xmlSerializers[skey];
if (xmlSerializer == null)
{
xmlSerializer = new XmlSerializer(type, new XmlRootAttribute("xml"));
_serializers[skey] = xmlSerializer;
xmlSerializer = new XmlSerializer(type, _xmlRoot);
_xmlSerializers[skey] = xmlSerializer;
}
return xmlSerializer;