Ejemplo n.º 1
0
        public void GetUserGroups_WhenUserNotInDataSet_ReturnsDefaultGroup()
        {
            TestGroupsDataSet loadedDataSet = new TestGroupsDataSet(TestResourceName);

            loadedDataSet.Load(GetCorrectData());

            // Expecting a user to be in 'all' group
            Assert.True(loadedDataSet.GetUserGroups("*****@*****.**").Count() == 1, "Expected 1 group for [email protected]");
            Assert.True(loadedDataSet.GetUserGroups("*****@*****.**").Contains("all"), "Expected groups for [email protected] to contain group 'all'");
        }
Ejemplo n.º 2
0
        public void GetUserGroups_WhenDataSetIsEmpty_ReturnsDefaultGroup()
        {
            FailOnErrors = false;

            TestGroupsDataSet emptyDataSet = new TestGroupsDataSet(TestResourceName);

            emptyDataSet.Load(GetIncorrectData());

            // Expecting a user to be in 'all' group in empty DataSet
            Assert.True(emptyDataSet.GetUserGroups("*****@*****.**").Count() == 1, "Expected 1 group for [email protected]");
            Assert.True(emptyDataSet.GetUserGroups("*****@*****.**").Contains("all"), "Expected groups for [email protected] to contain group 'all'");
        }
Ejemplo n.º 3
0
        public void GetUserGroups_InputInDifferentCasing_ReturnsCorrectResult()
        {
            TestGroupsDataSet testGroupsDataSet = new TestGroupsDataSet(TestResourceName);

            if (!testGroupsDataSet.Load(GetCorrectData()))
            {
                Assert.True(false, GetDataSetLoadingErrors(testGroupsDataSet));
            }

            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Count() == 3, "Expected GetUserGroups search to be case insensitive");
        }
Ejemplo n.º 4
0
        public void Load_ValidTestGroupsXml_LoadsUserGroups()
        {
            TestGroupsDataSet testGroupsDataSet = new TestGroupsDataSet(TestResourceName);

            if (!testGroupsDataSet.Load(GetCorrectData()))
            {
                Assert.Empty(GetDataSetLoadingErrors(testGroupsDataSet));
            }

            //Expecting correct groups returned for emails
            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Count() == 3, "Expected 3 groups for [email protected]");
            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Contains("Test"), "Expected groups for [email protected] to contain Test");
            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Contains("Automation"), "Expected groups for [email protected] to contain Automation");
            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Contains("all"), "Expected groups for [email protected] to contain group 'all'");

            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Count() == 2, "Expected 2 groups for [email protected]");
            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Contains("Test"), "Expected groups for [email protected] to contain Test");
            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Contains("all"), "Expected groups for [email protected] to contain group 'all'");

            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Count() == 2, "Expected 2 groups for [email protected]");
            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Contains("Automation"), "Expected groups for [email protected] to contain Automation");
            Assert.True(testGroupsDataSet.GetUserGroups("*****@*****.**").Contains("all"), "Expected groups for [email protected] to contain group 'all'");

            //Expecting correct users returned for groups
            Assert.True(testGroupsDataSet.GetGroupUsers("Test").Count() == 4, "Expected 4 users for Test group");
            Assert.True(testGroupsDataSet.GetGroupUsers("Test").Contains("*****@*****.**", StringComparer.OrdinalIgnoreCase), "Expected [email protected] to be in Test");
            Assert.True(testGroupsDataSet.GetGroupUsers("Test").Contains("*****@*****.**", StringComparer.OrdinalIgnoreCase), "Expected [email protected] to be in Test");

            Assert.True(testGroupsDataSet.GetGroupUsers("Automation").Count() == 2, "Expected 2 users for Automation group");
            Assert.True(testGroupsDataSet.GetGroupUsers("Automation").Contains("*****@*****.**", StringComparer.OrdinalIgnoreCase), "Expected [email protected] to be in Automation");
            Assert.True(testGroupsDataSet.GetGroupUsers("Automation").Contains("*****@*****.**", StringComparer.OrdinalIgnoreCase), "Expected [email protected] to be in Automation");

            Assert.True(testGroupsDataSet.GetGroupUsers("all").Count() == 6, "Expected 6 users for 'all' group");
            Assert.True(testGroupsDataSet.GetGroupUsers("all").Contains("*****@*****.**", StringComparer.OrdinalIgnoreCase), "Expected [email protected] to be in 'all'");
            Assert.True(testGroupsDataSet.GetGroupUsers("all").Contains("*****@*****.**", StringComparer.OrdinalIgnoreCase), "Expected [email protected] to be in 'all'");
            Assert.True(testGroupsDataSet.GetGroupUsers("all").Contains("*****@*****.**", StringComparer.OrdinalIgnoreCase), "Expected [email protected] to be in 'all'");
        }