public void RegisterSerializerCorrectlyWithOveridingDefault()
        {
            StandardSerializerFactory factory = new StandardSerializerFactory();

            factory.RegisterSerializer(typeof(bool), new TestSerializer(), overrideDefault: true);

            ISerializer serializer        = factory.GetSerializer("Test_Serializer");
            ISerializer defaultSerializer = factory.GetDefaultSerializer <bool>();

            Assert.Equal(serializer, defaultSerializer);
        }
        /// <summary>
        /// Decrypts each ciphertext value of a sequence using the provided <see cref="DataEncryptionKey"/>.
        /// </summary>
        /// <typeparam name="T">The type of the plaintext elements of <paramref name="source"/></typeparam>
        /// <param name="source">A sequence of encrypted values to decrypt.</param>
        /// <param name="encryptionKey">The key used to decrypt the ciphertext values of <paramref name="source"/>.</param>
        /// <returns>An <see cref="IEnumerable{T}"/> whose elements are the result of decrypting each element of <paramref name="source"/>.</returns>
        /// <remarks>
        /// This method decrypts data that was encrypted using <see cref="EncryptionType.Randomized"/> encryption and the
        /// default serializer registered under type <typeparamref name="T"/> with the <see cref="StandardSerializerFactory"/>
        /// </remarks>
        /// <exception cref="MicrosoftDataEncryptionException"><paramref name="encryptionKey"/> is null.</exception>
        public static IEnumerable <T> Decrypt <T>(this IEnumerable <byte[]> source, DataEncryptionKey encryptionKey)
        {
            encryptionKey.ValidateNotNull(nameof(encryptionKey));

            DataProtector             encryptionAlgorithm = AeadAes256CbcHmac256EncryptionAlgorithm.GetOrCreate(encryptionKey, EncryptionType.Randomized);
            Serializer <T>            serializer          = StandardSerializerFactory.Default.GetDefaultSerializer <T>();
            StandardSerializerFactory myFactory           = new StandardSerializerFactory();

            myFactory.RegisterSerializer(typeof(string), new SqlNCharSerializer());

            foreach (byte[] item in source)
            {
                byte[] plaintextData = encryptionAlgorithm.Decrypt(item);
                yield return(serializer.Deserialize(plaintextData));
            }
        }