File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Mastercard.Developer.ClientEncryption.Tests/NetCore/Encryption Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,27 @@ public void TestEncryptPayload_ShouldEncryptPrimitiveTypes_String()
160160 TestUtils . AssertDecryptedPayloadEquals ( "{\" data\" :\" string\" }" , encryptedPayload , config ) ;
161161 }
162162
163+ [ TestMethod ]
164+ public void TestEncryptPayload_ShouldEncryptPrimitiveTypes_NumberAsString ( )
165+ {
166+ // GIVEN
167+ const string payload = "{\" data\" : \" 123\" , \" encryptedData\" : {}}" ;
168+ var config = TestUtils . GetTestFieldLevelEncryptionConfigBuilder ( )
169+ . WithEncryptionPath ( "data" , "encryptedData" )
170+ . WithDecryptionPath ( "encryptedData" , "data" )
171+ . WithOaepPaddingDigestAlgorithm ( "SHA-256" )
172+ . Build ( ) ;
173+
174+ // WHEN
175+ var encryptedPayload = FieldLevelEncryption . EncryptPayload ( payload , config ) ;
176+
177+ // THEN
178+ var encryptedPayloadObject = JObject . Parse ( encryptedPayload ) ;
179+ Assert . IsNull ( encryptedPayloadObject [ "data" ] ) ;
180+ Assert . IsNotNull ( encryptedPayloadObject [ "encryptedData" ] ) ;
181+ TestUtils . AssertDecryptedPayloadEquals ( "{\" data\" :123}" , encryptedPayload , config ) ;
182+ }
183+
163184 [ TestMethod ]
164185 public void TestEncryptPayload_ShouldEncryptPrimitiveTypes_Integer ( )
165186 {
You can’t perform that action at this time.
0 commit comments