Beispiel #1
0
        public void CreateFileTest()
        {
            FileManager target = new FileManager(); // TODO: Initialize to an appropriate value

            String fileName = "MyFile.txt";
            String content = "Content of my file";

            target.CreateFile(fileName, content);

            Assert.IsTrue(target.FileExists(fileName));

            System.IO.File.Delete(fileName);
        }
Beispiel #2
0
        public void DeleteFileTest()
        {
            FileManager target = new FileManager(); // TODO: Initialize to an appropriate value

            String fileName = "MyFile1.txt";
            String content = "Content of my file";

            createFile(fileName, Encoding.ASCII.GetBytes(content));

            target.DeleteFile(fileName);

            Assert.IsFalse(target.FileExists(fileName));
            try
            {
                System.IO.File.Delete(fileName);
            }
            catch (Exception e)
            {
            }
        }
Beispiel #3
0
        public void FileExistsTest()
        {
            FileManager target = new FileManager(); // TODO: Initialize to an appropriate value
            string fileName = "MyFile.txt"; // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            String content = "Content";
            bool actual;
            
            actual = target.FileExists(fileName);
            Assert.AreEqual(false, actual);

            createFile(fileName, Encoding.ASCII.GetBytes(content));
            actual = target.FileExists(fileName);
            Assert.AreEqual(expected, actual);
            System.IO.File.Delete(fileName);
        }
Beispiel #4
0
        public void ReadFileTest()
        {
            FileManager target = new FileManager(); // TODO: Initialize to an appropriate value

            String fileName = "MyFile.txt";
            String content = "Content of my file";

            createFile(fileName, Encoding.ASCII.GetBytes(content));
            
            Assert.IsTrue(target.FileExists(fileName));
            Assert.AreEqual(content, target.ReadFile(fileName).ToString());
            System.IO.File.Delete(fileName);
        }