public void Test_FromString_FullPermissions() { var set = FilePermissionSet.FromString("rwx"); Assert.IsTrue(set.CanRead); Assert.IsTrue(set.CanWrite); Assert.IsTrue(set.CanExecute); Assert.AreEqual(7, set.NumericValue); }
public void Test_FromString_NullInput() { var set = FilePermissionSet.FromString(null); Assert.IsFalse(set.CanRead); Assert.IsFalse(set.CanWrite); Assert.IsFalse(set.CanExecute); Assert.AreEqual(0, set.NumericValue); Assert.AreEqual("---", set.ToString()); }
public void Test_FromString_ReadAndExecute() { var set = FilePermissionSet.FromString("r-x"); Assert.IsTrue(set.CanRead); Assert.IsFalse(set.CanWrite); Assert.IsTrue(set.CanExecute); Assert.AreEqual(5, set.NumericValue); Assert.AreEqual("r-x", set.ToString()); }
public void Test_FromString_WriteOnly() { var set = FilePermissionSet.FromString("-w-"); Assert.IsFalse(set.CanRead); Assert.IsTrue(set.CanWrite); Assert.IsFalse(set.CanExecute); Assert.AreEqual(2, set.NumericValue); Assert.AreEqual("-w-", set.ToString()); }
public void Test_FromString_InvalidInput() { var set = FilePermissionSet.FromString("------abc123"); }