示例#1
0
        public async Task StackModelFakeRazorWithStackStringsInMemoryAsync()
        {
            var albums    = DataGenerator.GetStackAlbums();
            var razorPage = new StackAlbumFakeRazorPage_Stack(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 StackModelFakeRazorWithStackStringsInFileAsync()
        {
            var albums    = DataGenerator.GetStackAlbums();
            var razorPage = new StackAlbumFakeRazorPage_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();
                }
        }