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)); }
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)); }
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()); }
public void Selection_SelectionTypeNoneWithSelectionThatDoesNotExist_Fails() { var systemUnderTest = new SelectionAttribute(SelectionType.None, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" }); Assert.IsFalse(systemUnderTest.IsValid("NotExist")); }
public void Selection_SelectionTypeNoneWithSelectionThatExists_Validates() { var systemUnderTest = new SelectionAttribute(SelectionType.None, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" }); Assert.IsTrue(systemUnderTest.IsValid("Key1")); }
public void Selection_IsValidNullSelection_Validates() { var systemUnderTest = new SelectionAttribute(SelectionType.Default, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" }); Assert.IsTrue(systemUnderTest.IsValid(null)); }
public void Selection_SelectionEmpty_Validates() { var systemUnderTest = new SelectionAttribute(SelectionType.Default, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" }); Assert.IsTrue(systemUnderTest.IsValid(string.Empty)); }
public void Selection_SelectionTypeMultipleWithEmptySelection_Validates() { var systemUnderTest = new SelectionAttribute(SelectionType.Multiple, new[] { "Key1", "Key2" }, new[] { "Value1", "Value2" }); Assert.IsTrue(systemUnderTest.IsValid(new[] { string.Empty })); }