Пример #1
0
 public void tearDown()
 {
     TempFile1.file_Delete();
     TempFile2.file_Delete();
     Assert.IsFalse(TempFile1.fileExists());
     Assert.IsFalse(TempFile2.fileExists());
 }
Пример #2
0
 public void setup()
 {
     TempFile1 = "tempFile".tempFile();
     TempFile1 = "tempFile".tempFile();
     Assert.AreNotEqual(TempFile1, TempFile2);
     Assert.IsFalse(TempFile1.fileExists());
     Assert.IsFalse(TempFile2.fileExists());
 }
Пример #3
0
        public void file_Attributes()
        {
            fileInfo();
            var fileAttributes1 = TempFile1.fileInfo().Attributes;
            var fileAttributes2 = TempFile1.file_Attributes();

            Assert.AreEqual(fileAttributes1, fileAttributes2);

            Assert.AreEqual(default(FileAttributes), (null as string).file_Attributes());
        }
Пример #4
0
        public void file_Delete()
        {
            "aaaa".saveAs(TempFile1);
            TempFile1.file_Attribute_ReadOnly_Add();
            var deleteResult_ReadOnly = TempFile1.file_Delete();

            TempFile1.file_Attribute_ReadOnly_Remove();
            var deleteResult_NotReadOnly = TempFile1.file_Delete();

            Assert.IsFalse(deleteResult_ReadOnly);
            Assert.IsTrue(deleteResult_NotReadOnly);
        }
Пример #5
0
        public void readOnly_Add()
        {
            var testContent = "testContent".add_RandomLetters(200);

            testContent.saveAs(TempFile1);
            var fileInfo   = TempFile1.fileInfo();
            var attributes = fileInfo.attributes();

            Assert.IsTrue(attributes.str().contains("Archive"));
            Assert.IsTrue(TempFile1.file_Has_Attribute(FileAttributes.Archive));
            Assert.IsFalse(TempFile1.file_Has_Attribute(FileAttributes.ReadOnly));

            fileInfo.readOnly_Add();
            Assert.IsTrue(TempFile1.file_Has_Attribute(FileAttributes.ReadOnly));
            var deleteResult = fileInfo.path().file_Delete();

            Assert.IsFalse(deleteResult);
            fileInfo.readOnly_Remove();
            Assert.IsFalse(TempFile1.file_Has_Attribute(FileAttributes.ReadOnly));
        }
Пример #6
0
        public void fileInfo()
        {
            var testContent = "testContent".add_RandomLetters(200);

            testContent.saveAs(TempFile1);
            var fileInfo = TempFile1.fileInfo();

            Assert.IsNotNull(fileInfo);
            Assert.IsInstanceOf <FileInfo>(fileInfo);
            Assert.AreEqual(TempFile1, fileInfo.FullName);
            Assert.AreEqual(testContent.size(), fileInfo.size());
            Assert.IsTrue(fileInfo.Exists);

            var nonExistingFile = 50.randomLetters().fileInfo();

            Assert.IsNotNull(nonExistingFile);
            Assert.IsFalse(nonExistingFile.Exists);
            //test catch

            Assert.IsNull((null as string).fileInfo());
        }