Пример #1
0
        public void IsUserInGroups_InputInDifferentCasing_ReturnsCorrectResult()
        {
            using (IConfigurationDataSetLoader <TestGroupsDataSet> loader =
                       new UnitTestTestGroupsDataSetLoader(new UnitTestResourceMonitor()))
            {
                CheckTestGroupsDataSetLoader(loader);
                TestGroups testGroups = new TestGroups(loader);

                Assert.True(testGroups.IsUserInGroups("*****@*****.**", "aUTOMATION"),
                            "Expected IsUserInGroups search to be case insensitive");
            }
        }
Пример #2
0
        public void GetGroupUsers_GroupNotInDataSet_ReturnsEmptyList()
        {
            using (IConfigurationDataSetLoader <TestGroupsDataSet> loader =
                       new UnitTestTestGroupsDataSetLoader(new UnitTestResourceMonitor()))
            {
                CheckTestGroupsDataSetLoader(loader);
                TestGroups testGroups = new TestGroups(loader);

                Assert.False(testGroups.GetGroupUsers("GroupNotInTestGroups").Any(),
                             "Returns empty list when group is not in DataSet.");
            }
        }
Пример #3
0
 public void IsDefault_GroupNamesDoNotContainDefault_ReturnsFalse()
 {
     using (IConfigurationDataSetLoader <TestGroupsDataSet> loader =
                new UnitTestTestGroupsDataSetLoader(new UnitTestResourceMonitor()))
     {
         CheckTestGroupsDataSetLoader(loader);
         TestGroups testGroups = new TestGroups(loader);
         Assert.False(testGroups.IsDefault("group1;group2;group3;"),
                      "IsDefault returns false if test groups do not contain default group.");
         Assert.False(testGroups.IsDefault("groupallgroup;allgroup;groupall;"),
                      "IsDefault returns false if test groups contain 'all' as substring.");
     }
 }
Пример #4
0
        public void GetDeploymentIdGroups_IdNotInDataSet_ReturnsDefaultGroups()
        {
            using (IConfigurationDataSetLoader <TestGroupsDataSet> loader =
                       new UnitTestTestGroupsDataSetLoader(new UnitTestResourceMonitor()))
            {
                CheckTestGroupsDataSetLoader(loader);
                TestGroups testGroups = new TestGroups(loader);

                Assert.True(
                    testGroups.GetDeploymentIdGroups(DeploymentIdNotInDataSet).Intersect(loader.LoadedDataSet.DefaultGroups).Count() ==
                    loader.LoadedDataSet.DefaultGroups.Count(),
                    "Returns default access groups list when deploymentId is not in DataSet.");
            }
        }
Пример #5
0
        public void GetGroupUsers_GroupInDataSet_ReturnsUsers()
        {
            using (IConfigurationDataSetLoader <TestGroupsDataSet> loader =
                       new UnitTestTestGroupsDataSetLoader(new UnitTestResourceMonitor()))
            {
                CheckTestGroupsDataSetLoader(loader);
                TestGroups testGroups = new TestGroups(loader);

                List <string> groupUsers = testGroups.GetGroupUsers("Automation").ToList();
                Assert.True(groupUsers.Count == 2, "Returns 2 users for Automation group.");
                Assert.True(groupUsers.Contains("*****@*****.**"), "Group contains [email protected]");
                Assert.True(groupUsers.Contains("*****@*****.**"), "Group contains [email protected]");
            }
        }
Пример #6
0
        public void GetDeploymentIdGroups_IdInDataSet_ReturnsExpectedGroups()
        {
            using (IConfigurationDataSetLoader <TestGroupsDataSet> loader =
                       new UnitTestTestGroupsDataSetLoader(new UnitTestResourceMonitor()))
            {
                CheckTestGroupsDataSetLoader(loader);
                TestGroups testGroups = new TestGroups(loader);

                List <string> userGroups = testGroups.GetDeploymentIdGroups(DeploymentId).ToList();
                Assert.Equal(3, userGroups.Count);
                Assert.True(userGroups.Contains("Test"), "Groups contain Test");
                Assert.True(userGroups.Contains("Probes"), "Groups contain Probes");
                Assert.True(userGroups.Contains("all"), "Groups contain group 'all'");
            }
        }
Пример #7
0
 public void IsDefault_GroupNamesContainDefault_ReturnsTrue()
 {
     using (IConfigurationDataSetLoader <TestGroupsDataSet> loader =
                new UnitTestTestGroupsDataSetLoader(new UnitTestResourceMonitor()))
     {
         CheckTestGroupsDataSetLoader(loader);
         TestGroups testGroups = new TestGroups(loader);
         Assert.True(testGroups.IsDefault("all;group2;group3;"),
                     "IsDefault returns true if test groups contain default group in the beginning.");
         Assert.True(testGroups.IsDefault("group1;group2;all;"),
                     "IsDefault returns true if test groups contain default group in the end followed by delimiter.");
         Assert.True(testGroups.IsDefault("group1;group2;all"),
                     "IsDefault returns true if test groups contain default group in the end not followed by delimiter.");
         Assert.True(testGroups.IsDefault("group1;all;group3"),
                     "IsDefault returns true if test groups contain default group in the middle.");
     }
 }