public static void SetupTest()

in AdlsDotNetSDKUnitTest/LinkPathUnitTest.cs [31:86]


        public static void SetupTest(TestContext context)
        {
            _shoudRunLinkTests = bool.Parse((string)context.Properties["LinkTestsEnabled"]);
            if (!_shoudRunLinkTests)
                return;

            // TODO Refactor this into separate functions methods
            LinkPath1 = context.Properties["LinkPaths"].ToString().Split(',')[0].TrimEnd('/');
            int slashIndex = 0;
            // After the loop for LinkPath1 = /abc/def/xyz, createDirsRoot = {"/abc", "/abc/def/"}
            while (true)
            {
                slashIndex = LinkPath1.IndexOf('/', slashIndex + 1);
                if (slashIndex == -1)
                {
                    break;
                }

                createDirsRoot.Add(LinkPath1.Substring(0, slashIndex));
            }

            LinkPath1Root = createDirsRoot[0];
            _adlsClient = SdkUnitTest.SetupSuperClient();
            var random = new System.Random();
            foreach (var dirRoot in createDirsRoot)
            {
                foreach (var index in Enumerable.Range(0, random.Next() % 7)) // Create between 0 to 6 directories
                {
                    var dirName = dirRoot + SdkUnitTest.RandomString(10) + "/";
                    createdDirs.Add(dirName);
                    _adlsClient.CreateDirectory(dirName);
                }
            }

            string text = "I am the first line";
            byte[] textByte = Encoding.UTF8.GetBytes(text);
            foreach (var dirs in createdDirs)
            {
                foreach (var index in Enumerable.Range(0, random.Next() % 7)) // Create between 0 to 6 files
                {
                    var fileName = dirs + SdkUnitTest.RandomString(10) + ".txt";
                    createdFiles.Add(fileName);
                    using (var ostream = _adlsClient.CreateFile(fileName, IfExists.Overwrite))
                    {
                        ostream.Write(textByte, 0, textByte.Length);
                    }
                }
            }

            _aclEntriesToSet = new List<AclEntry>()
            {
                new AclEntry(AclType.user, SdkUnitTest.NonOwner1ObjectId, AclScope.Access, AclAction.ReadWrite),
                new AclEntry(AclType.user, SdkUnitTest.NonOwner2ObjectId, AclScope.Access, AclAction.WriteOnly),
                new AclEntry(AclType.user, SdkUnitTest.Group1Id, AclScope.Default, AclAction.WriteExecute)
            };
        }