コード例 #1
0
        public void AppendText()
        {
            string tempFile = Path.GetTempFileName();
            string expected = "This is a test.";

            ExtendedFileInfo efi = new ExtendedFileInfo(tempFile);

            Assert.IsNotNull(efi);

            using (StreamWriter writer = efi.AppendText())
            {
                Assert.IsNotNull(writer);
                writer.Write(expected);
            }

            string actual = File.ReadAllText(tempFile);

            Assert.AreEqual(expected, actual);
        }