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