Esempio n. 1
0
        public void GetFileTrue()
        {
            string name;

            byte[] content;
            Assert.True(storageDatabaseUtils.GetFile(670, out name, out content));
        }
Esempio n. 2
0
        public void Test_GetFile()
        {
            string fileName;

            byte[] fileContent;
            int    id         = (int)_databaseConnection.GetFiles().Rows[0][0];
            var    result     = _databaseConnection.GetFile(id, out fileName, out fileContent);
            var    fileWorker = new FileWorker("../../../test/" + fileName);
            string content    = fileWorker.ReadAll();
            string data       = Encoding.ASCII.GetString(fileContent);

            Assert.IsTrue(result);
            Assert.AreEqual(content, data);
        }
Esempio n. 3
0
        public void PositiveAddFile()
        {
            string filepath = testsDirFullPath + "\\" + "file.txt";
            string lines    = "HELLO!";

            BaseFileWorker.Write(lines, filepath);

            byte[] byteArr = File.ReadAllBytes(filepath);

            storageDatкabaseUtils.AddFile(filepath, byteArr);

            byte[] returnedArr;
            string returnedFileName;

            int returned = int.Parse(storageDatкabaseUtils.GetFiles(filepath).Rows[0]["FileID"].ToString());

            storageDatкabaseUtils.GetFile(returned, out returnedFileName, out returnedArr);


            Assert.AreEqual(byteArr, returnedArr);
            Assert.AreEqual(filepath, returnedFileName);
        }