예제 #1
0
        private void TryReplace(string input, string pageId, string replacement, string expectedOutput)
        {
            using (var inputStream = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(input))))
                using (var output = new MemoryStream())
                    using (var outputStream = new StreamWriter(output))
                    {
                        BookStorage.ReplacePage(pageId, inputStream, outputStream, replacement);
                        outputStream.Flush();

                        output.Position = 0;
                        string result = new StreamReader(output).ReadToEnd();
                        Assert.That(result, Is.EqualTo(expectedOutput));
                    }
        }