public void CanCreateAccessDefinition()
        {
            AccessMode modes = AccessMode.Write | AccessMode.Read;

            AccessDefinitionParameters parameters = new AccessDefinitionParameters
            {
                Modes            = modes,
                AccessModesLabel = GetAccessModesLabel(modes)
            };

            CreateAccessDefinition(parameters);

            // Assertions for creation
            // Check for last table row which contains latest access definition
            IReadOnlyList <IWebElement> result = Driver.FindElements(By.CssSelector("tr:last-child td"));

            Assert.GreaterOrEqual(result.Count, 2);
            Assert.AreEqual(parameters.AccessModesLabel, result[0].Text);

            // second td element has list of access modes
            List <string> retreivedModes = result[1].Text.Split(',').Select(x => x.Trim()).ToList();
            List <string> allModes       = modes.AsStringList();

            foreach (string currentMode in retreivedModes)
            {
                Assert.Contains(currentMode, allModes);
            }

            // Destroy access definition
            int rowsBeforeDeletion = Driver.FindElements(By.TagName("tr")).Count();

            // result[4] has the delete button
            result[4].Click();
            Driver.SwitchTo().Alert().Accept();
            WaitPageSourceChange(5, 500);
            int rowsAfterDeletion = Driver.FindElements(By.TagName("tr")).Count();

            // Check if it was detroyed
            Assert.AreEqual(rowsBeforeDeletion - 1, rowsAfterDeletion);
        }
 private string GetAccessModesLabel(AccessMode accessModes)
 {
     return(String.Join(" - ", accessModes.AsStringList()));
 }