예제 #1
0
        public void ModifyRequestForRewriteSource_NotNone()
        {
            EncryptionKey key     = EncryptionKey.Create(new byte[32]);
            var           request = new HttpRequestMessage();

            key.ModifyRequestForRewriteSource(request);
            IEnumerable <string> values;

            Assert.True(request.Headers.TryGetValues(EncryptionKey.CopySourceAlgorithmHeader, out values));
            Assert.Equal(new[] { EncryptionKey.AlgorithmValue }, values);
            Assert.True(request.Headers.TryGetValues(EncryptionKey.CopySourceKeyHeader, out values));
            Assert.Equal(new[] { "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" }, values);
            Assert.True(request.Headers.TryGetValues(EncryptionKey.CopySourceKeyHashHeader, out values));
            Assert.Equal(new[] { "Zmh6rfhivXdsj8GLjp+OIAiXFIVu4jOzkCpZHQ1fKSU=" }, values);

            Assert.False(request.Headers.TryGetValues(EncryptionKey.AlgorithmHeader, out values));
            Assert.False(request.Headers.TryGetValues(EncryptionKey.KeyHeader, out values));
            Assert.False(request.Headers.TryGetValues(EncryptionKey.KeyHashHeader, out values));
        }