in AdlsDotNetSDKUnitTest/SdkUnitTest.cs [1778:1829]
public void TestSetPermissionFolder()
{
string path = $"{UnitTestDir}/SetPermissionFolder";
string originalPermission = "771";
string permission = "772";
_adlsClient.CreateDirectory(path, originalPermission);
string testFile = path + "/testFile.txt";
try
{
using (_adlsClient.CreateFile(testFile, IfExists.Overwrite, "776"))
{ }
}
catch (IOException)
{
Assert.Fail("Owner should have write permission so CreateFile should not raise an exception");
}
AdlsClient nonOwner1 = SetupNonOwnerClient1();
try
{
using (nonOwner1.GetReadStream(testFile))
{
}
}
catch (IOException)
{
Assert.Fail("Nonowner1 should have execute permission so ReadStream should not raise an exception");
}
_adlsClient.SetPermission(path, permission);
DirectoryEntry diren = _adlsClient.GetDirectoryEntry(path);
Assert.IsTrue(diren.Permission == permission);
try
{
using (nonOwner1.GetReadStream(testFile))
{
}
Assert.Fail("Nonowner1 should not have execute permission so ReadStream should raise an exception");
}
catch (IOException)
{ }
try
{
using (nonOwner1.GetAppendStream(testFile))
{ }
Assert.Fail("Nonowner1 should not have execute permission so AppendStream should raise an exception");
}
catch (IOException)
{
}
}