コード例 #1
0
        [InlineData(@"едц")]    // to ensure that our encode/decode of compressed string works with "problematic" foreign characters
        public async System.Threading.Tasks.Task TestRoundTripAsync(string testString)
        {
            //compress a string via the Compress Function
            var result = await Functions.Compress(TestFactory.CreateHttpRequest(testString), TestFactory.CreateLogger(LoggerTypes.List)).ConfigureAwait(false);

            Assert.NotNull(result);

            Assert.IsType <OkObjectResult>(result);
            var resultValue = (string)((OkObjectResult)result).Value;

            Assert.False(string.IsNullOrEmpty(resultValue));

            // pass the result into the Decompress function
            result = await Functions.Decompress(TestFactory.CreateHttpRequest(resultValue), TestFactory.CreateLogger(LoggerTypes.List)).ConfigureAwait(false);

            Assert.NotNull(result);

            Assert.IsType <OkObjectResult>(result);
            resultValue = (string)((OkObjectResult)result).Value;

            Assert.False(string.IsNullOrEmpty(resultValue));

            // Assert the result matches what we used in the beginning
            Assert.Equal(testString, resultValue);
        }
コード例 #2
0
        public async System.Threading.Tasks.Task TestDecompressionAsync(string dataToDecompress)
        {
            var result = await Functions.Decompress(TestFactory.CreateHttpRequest(dataToDecompress), TestFactory.CreateLogger(LoggerTypes.List)).ConfigureAwait(false);

            Assert.NotNull(result);

            Assert.IsType <OkObjectResult>(result);
            var resultValue = (string)((OkObjectResult)result).Value;

            Assert.False(string.IsNullOrEmpty(resultValue));

            Console.WriteLine($@"Result: {resultValue}");
        }