Esempio n. 1
0
        public static string getResponseFromFile(string filePath, string fileName)
        {
            if (String.IsNullOrEmpty(filePath))
            {
                throw new MdoException(MdoExceptionCode.ARGUMENT_INVALID, "Invalid FilePath");
            }

            if (String.IsNullOrEmpty(fileName))
            {
                throw new MdoException(MdoExceptionCode.ARGUMENT_INVALID, "Invalid FileName");
            }

            return(FileIOUtils.readFromFile(Path.Combine(filePath, fileName)));
        }
Esempio n. 2
0
        public void testWriteAndReadToFileString()
        {
            string data = "This is some yummy data to test write";

            FileIOUtils.writeToFile(FILE_NAME, data, false);
            Assert.IsTrue(File.Exists(FILE_NAME));

            string expected = data;

            Assert.AreEqual(expected, FileIOUtils.readFromFile(FILE_NAME));

            FileIOUtils.writeToFile(FILE_NAME, data, true);
            Assert.AreEqual(expected + expected, FileIOUtils.readFromFile(FILE_NAME));
        }
Esempio n. 3
0
        public void testWriteAndReadToFileArray()
        {
            string[] data =
            {
                "This is some yummy data to test write...",
                "And this is even more scrumptiousness...",
                "Then to top it all off, here's a tasty little morsel."
            };

            FileIOUtils.writeToFile(FILE_NAME, data, false);
            Assert.IsTrue(File.Exists(FILE_NAME));

            string expected = data[0] + StringUtils.CRLF + data[1] + StringUtils.CRLF + data[2] + StringUtils.CRLF;

            Assert.AreEqual(expected, FileIOUtils.readFromFile(FILE_NAME));

            FileIOUtils.writeToFile(FILE_NAME, data, true);
            Assert.AreEqual(expected + expected, FileIOUtils.readFromFile(FILE_NAME));
        }