本文整理汇总了C#中JsonSerializer.DeSerialize方法的典型用法代码示例。如果您正苦于以下问题:C# JsonSerializer.DeSerialize方法的具体用法?C# JsonSerializer.DeSerialize怎么用?C# JsonSerializer.DeSerialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonSerializer
的用法示例。
在下文中一共展示了JsonSerializer.DeSerialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestThatEncryptTagGetsEncrypted
public void TestThatEncryptTagGetsEncrypted()
{
var crypto = new JsonConfigCrypto(_cryptoKey);
var encryptedJson = crypto.Encrypt(_encryptJson);
var decryptedJson = crypto.Decrypt(encryptedJson);
var serializer = new JsonSerializer<ConDepEnvConfig>(crypto);
serializer.DeSerialize(decryptedJson);
}
示例2: TestThatEncryptedJsonCanBeDecryptedIntoTypedConfig
public void TestThatEncryptedJsonCanBeDecryptedIntoTypedConfig()
{
//var parser = new EnvConfigParser(new ConfigJsonSerializer(new JsonConfigCrypto()), new JsonConfigCrypto());
var cryptoHandler = new JsonConfigCrypto(_cryptoKey);
var serializer = new JsonSerializer<ConDepEnvConfig>(cryptoHandler);
//parser.Encrypted(_json, out config);
var config = serializer.DeSerialize(_json);
string deploymentPassword = config.DeploymentUser.Password;
string lbPassword = config.LoadBalancer.Password;
var encryptedJson = cryptoHandler.Encrypt(_json);
//parser.EncryptJsonConfig(config, crypto);
//var encryptedJson = parser.ConvertToJsonText(config);
Assert.That(cryptoHandler.IsEncrypted(encryptedJson), Is.True);
var decryptedConfig = serializer.DeSerialize(encryptedJson);
Assert.That(decryptedConfig.DeploymentUser.Password, Is.EqualTo(deploymentPassword));
Assert.That(decryptedConfig.LoadBalancer.Password, Is.EqualTo(lbPassword));
}