public void AppendFileFactoryCanOpenFileMultipleTimes()
        {
            string fileName = GetFileName();
            string actual   = String.Empty;
            string expected = String.Empty;

            PrepareEmptyFile(fileName);

            AppendFileFactory fileFactory = new AppendFileFactory(fileName);

            using (StreamWriter f = fileFactory.GetOuputFile())
            {
                f.WriteLine(testText);
            }

            using (StreamWriter f = fileFactory.GetOuputFile())
            {
                f.WriteLine(testText);
            }

            expected = testText + Environment.NewLine + testText + Environment.NewLine;
            actual   = File.ReadAllText(fileName);

            Assert.AreEqual(expected, actual);
        }
        public void AppendFileFactoryCanCreateNewFile()
        {
            string fileName = GetFileName();
            string fileText = String.Empty;

            DeleteFile(fileName);

            AppendFileFactory fileFactory = new AppendFileFactory(fileName);

            using (StreamWriter f = fileFactory.GetOuputFile())
            {
                f.WriteLine(string.Empty);
            }

            Assert.IsTrue(File.Exists(fileName));
        }
 public void AppendFileFictoryCannotBeCreatedWithNullFileName()
 {
     IFileFactory fileFactory = new AppendFileFactory(null);
 }
 public void AppendFileFictoryCannotBeCreatedWithAllSpacesFileName()
 {
     IFileFactory fileFactory = new AppendFileFactory("    ");
 }