Пример #1
0
        public async Task StackModelFakeRazorWithHeapStringsInMemoryAsync()
        {
            var albums    = DataGenerator.GetStackAlbums();
            var razorPage = new StackAlbumFakeRazorPage_Heap(albums, true);

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

                    await memoryStream.FlushAsync();
                }
        }
Пример #2
0
        public async Task StackModelFakeRazorWithHeapStringsInFileAsync()
        {
            var albums    = DataGenerator.GetStackAlbums();
            var razorPage = new StackAlbumFakeRazorPage_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();
                }
        }