Exemple #1
0
        public void Selection_GetSelectListItemsWithSelectedSingle_ReturnsSelectListItemsWithSelected()
        {
            var systemUnderTest = new SelectionAttribute(SelectionType.Single, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" });

            var selectItems = systemUnderTest.GetSelectListItems("Key1");

            Assert.IsTrue(selectItems.Any(m => m.Selected));
        }
Exemple #2
0
        public void Selection_GetSelectListItemsWithSelectedHavingEmptyMultiple_ReturnsSelectListItemsWithSelected()
        {
            var systemUnderTest = new SelectionAttribute(SelectionType.Multiple, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" });

            var selectItems = systemUnderTest.GetSelectListItems(new[] { string.Empty, "Key1" });

            Assert.IsTrue(selectItems.Any(m => m.Selected));
        }
Exemple #3
0
        public void Selection_GetSelectListItemsMultiple_ReturnsSelectListItems()
        {
            var systemUnderTest = new SelectionAttribute(SelectionType.Multiple, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" });

            var selectItems = systemUnderTest.GetSelectListItems();

            Assert.IsTrue(selectItems.Any());
        }
Exemple #4
0
        public void Selection_SelectionTypeNoneWithSelectionThatDoesNotExist_Fails()
        {
            var systemUnderTest = new SelectionAttribute(SelectionType.None, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" });

            Assert.IsFalse(systemUnderTest.IsValid("NotExist"));
        }
Exemple #5
0
        public void Selection_SelectionTypeNoneWithSelectionThatExists_Validates()
        {
            var systemUnderTest = new SelectionAttribute(SelectionType.None, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" });

            Assert.IsTrue(systemUnderTest.IsValid("Key1"));
        }
Exemple #6
0
        public void Selection_IsValidNullSelection_Validates()
        {
            var systemUnderTest = new SelectionAttribute(SelectionType.Default, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" });

            Assert.IsTrue(systemUnderTest.IsValid(null));
        }
Exemple #7
0
        public void Selection_SelectionEmpty_Validates()
        {
            var systemUnderTest = new SelectionAttribute(SelectionType.Default, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" });

            Assert.IsTrue(systemUnderTest.IsValid(string.Empty));
        }
Exemple #8
0
        public void Selection_SelectionTypeMultipleWithEmptySelection_Validates()
        {
            var systemUnderTest = new SelectionAttribute(SelectionType.Multiple, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" });

            Assert.IsTrue(systemUnderTest.IsValid(new[] { string.Empty }));
        }