示例#1
0
        public void IsReadonly_should_check_any_file_in_a_folder_when_specified()
        {
            var dirWithRoFile = CreateDir(@"Dir1");

            CreateFile(@"Dir1\RoFile", true);

            var dirWithoutRoFiles = CreateDir(@"Dir2");

            CreateFile(@"Dir2\noRoFile");

            var dirRo = CreateDir(@"Dir3", true);

            CreateFile(@"Dir3\noRoFile");

            var r1A = FilesystemTools.IsReadonly(dirWithRoFile, false);
            var r1B = FilesystemTools.IsReadonly(dirWithRoFile, true);
            var r2A = FilesystemTools.IsReadonly(dirWithoutRoFiles, false);
            var r2B = FilesystemTools.IsReadonly(dirWithoutRoFiles, true);
            var r3A = FilesystemTools.IsReadonly(dirRo, false);
            var r3B = FilesystemTools.IsReadonly(dirRo, true);

            r1A.Should().Be.False();
            r1B.Should().Be.True();
            r2A.Should().Be.False();
            r2B.Should().Be.False();
            r3A.Should().Be.True();
            r3B.Should().Be.True();
        }
示例#2
0
        public void IsReadonly_should_check_a_file()
        {
            var roFile   = CreateFile(@"ROFile", true);
            var noRoFole = CreateFile(@"noRoFole");

            var r1 = FilesystemTools.IsReadonly(roFile, false);
            var r2 = FilesystemTools.IsReadonly(noRoFole, false);

            r1.Should().Be.True();
            r2.Should().Be.False();
        }