public void DeserializeTheSameAsSqlServer(long plaintext) { Database.Insert(new SqlParameter("@parameter", SqlDbType.BigInt) { Value = plaintext }); byte[] ciphertextBytes = Database.SelectCiphertext(SqlDbType.BigInt); byte[] plaintextBytes = deterministicEncryptionAlgorithm.Decrypt(ciphertextBytes); SqlBigintSerializer serializer = new SqlBigintSerializer(); long expectedPlaintext = serializer.Deserialize(plaintextBytes); long actualPlaintext = (long)Database.SelectPlaintext(SqlDbType.BigInt); Assert.Equal(expectedPlaintext, actualPlaintext); }
public void ShouldThrowIfDeserializingLessThanEightBytes(byte[] data) { SqlBigintSerializer serializer = new SqlBigintSerializer(); Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Deserialize(data)); }
public void ShouldThrowIfDeserializingNull() { SqlBigintSerializer serializer = new SqlBigintSerializer(); Assert.Throws <ArgumentNullException>(() => serializer.Deserialize(null)); }