示例#1
0
        public async Task FakeRazorWithStackStringsInMemory()
        {
            var albums    = DataGenerator.GetHeapAlbums();
            var razorPage = new AlbumFakeRazorPage_Stack(albums, false);

            using (var memoryStream = new MemoryStream())
                using (var streamWriter = new StreamWriter(memoryStream))
                {
                    await razorPage.ExecuteAsync(streamWriter);

                    await memoryStream.FlushAsync();
                }
        }
示例#2
0
        public async Task FakeRazorWithStackStringsInFileAsync()
        {
            var albums    = DataGenerator.GetHeapAlbums();
            var razorPage = new AlbumFakeRazorPage_Stack(albums, true);

            using (var fileStream = new FileStream(Path.Combine(directory, Guid.NewGuid().ToString()), FileMode.CreateNew))
                using (var streamWriter = new StreamWriter(fileStream))
                {
                    await razorPage.ExecuteAsync(streamWriter);

                    await streamWriter.FlushAsync();

                    await fileStream.FlushAsync();
                }
        }