示例#1
0
        public async Task FakeRazorWithHeapStringsInMemory()
        {
            var albums    = DataGenerator.GetHeapAlbums();
            var razorPage = new AlbumFakeRazorPage_Heap(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 FakeRazorWithHeapStringsInFileAsync()
        {
            var albums    = DataGenerator.GetHeapAlbums();
            var razorPage = new AlbumFakeRazorPage_Heap(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();
                }
        }