public void Single_byte_works() { Coordinator.Configure(options => options.DataProtectionProvider = DataProtectionProvider.Create("test")); var foo = new FooByte { MyByte = 5 }; var json = JsonSerializer.Serialize(foo); // make sure it's encrypted using (var jsonDoc = JsonDocument.Parse(json)) { var jsonProperty = jsonDoc.RootElement.GetProperty(nameof(FooByte.MyByte)); jsonProperty.ValueKind.ShouldBe(JsonValueKind.String); jsonProperty.GetString().ShouldNotBe(foo.MyByte.ToString()); } // decrypt and check var decrypted = JsonSerializer.Deserialize <FooByte>(json); decrypted.MyByte.ShouldBe((byte)5); }
public FooByte GetFoo(FooByte foo) { return(null); }