Пример #1
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());
        }
Пример #2
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));
        }
Пример #3
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());
        }