public void WordTableField_SetValue_ShouldSelectItemInDropDownList() { _cellRange.ContentControls.Add(WdContentControlType.wdContentControlDropdownList); _cellRange.ContentControls[1].DropdownListEntries.Add("A", "A"); _cellRange.ContentControls[1].DropdownListEntries.Add("B", "B"); _fieldConfiguration.SetupGet(x => x.FieldValueType).Returns(FieldValueType.DropDownList); var wordField = new WordTableField(_cellRange, _fieldConfiguration.Object, _converter.Object, true); wordField.Value = "B"; Assert.IsTrue(_cellRange.ContentControls[1].Type == WdContentControlType.wdContentControlDropdownList); Assert.AreEqual("B", _cellRange.Text); }
public void WordTableField_SetAllowedValues_ShouldCreateDropDownList() { _fieldConfiguration.SetupGet(x => x.FieldValueType).Returns(FieldValueType.DropDownList); var wordField = new WordTableField(_cellRange, _fieldConfiguration.Object, _converter.Object, true); wordField.AllowedValues = new List <string> { "A", "B", "C" }; Assert.IsTrue(_cellRange.ContentControls[1].Type == WdContentControlType.wdContentControlDropdownList); Assert.AreEqual("A", _cellRange.ContentControls[1].DropdownListEntries[1].Text); Assert.AreEqual("C", _cellRange.ContentControls[1].DropdownListEntries[3].Text); }