public void APropertyDecoratedWithTheEncryptAttributeIsEncrypted() { var encryptionMechanism = new Base64EncryptionMechanism(); var configuration = new JsonSerializerConfiguration { EncryptionMechanism = encryptionMechanism, }; var serializer = new JsonSerializer <Waldo>(configuration); var instance = new Waldo { Qux = "abc", Garply = true }; var json = serializer.Serialize(instance); var expected = @"{""Qux"":""" + encryptionMechanism.Encrypt(@"""abc""") + @""",""Garply"":""" + encryptionMechanism.Encrypt("true") + @"""}"; Assert.That(json, Is.EqualTo(expected)); }
public void Waldo_Test() { Waldo waldo = null; Action act = () => waldo = Waldo.Instance; act.Should().Throw <InvalidOperationException>().WithInnerException <MissingMethodException>(); waldo.Should().BeNull(); }
public void APropertyDecoratedWithTheEncryptAttributeIsEncrypted() { var encryptionMechanism = new Base64EncryptionMechanism(); var configuration = new JsonSerializerConfiguration { EncryptionMechanism = encryptionMechanism, }; var serializer = new JsonSerializer<Waldo>(configuration); var instance = new Waldo { Qux = "abc", Garply = true }; var json = serializer.Serialize(instance); var expected = @"{""Qux"":""" + encryptionMechanism.Encrypt(@"""abc""") + @""",""Garply"":""" + encryptionMechanism.Encrypt("true") + @"""}"; Assert.That(json, Is.EqualTo(expected)); }