Exemple #1
0
 public void should_not_dispose_input_stream()
 {
     using (var stream = new Utf8RandomTextStream(10))
     {
         StatCharacterUsage(stream);
         Assert.False(stream.Disposed);
     }
 }
Exemple #2
0
        public void should_be_able_to_handle_very_large_stream()
        {
            const long length = 128 * 1024 * 1024;

            using (var stream = new Utf8RandomTextStream(length))
            {
                var watch = Stopwatch.StartNew();
                StatCharacterUsage(stream);
                watch.Stop();
                output.WriteLine($"Time used to handle {length / 1024 / 1024} MB of text: {watch.Elapsed:g}");
                Assert.True(watch.Elapsed < TimeSpan.FromSeconds(12), "Oh, too slow!");
            }
        }