public void DropDownMultipleValueEditor_With_Keys_Format_Data_For_Cache() { var dataTypeServiceMock = new Mock <IDataTypeService>(); var dataTypeService = dataTypeServiceMock.Object; var editor = new PublishValuesMultipleValueEditor(true, dataTypeService, new PropertyValueEditor()); var prop = new Property(1, Guid.NewGuid(), new PropertyType(new DataTypeDefinition(1, "Test.TestEditor")), "1234,4567,8910"); var result = editor.ConvertDbToString(prop, prop.PropertyType, new Mock <IDataTypeService>().Object); Assert.AreEqual("1234,4567,8910", result); }
public void DropDownMultipleValueEditor_No_Keys_Format_Data_For_Cache() { var dataTypeServiceMock = new Mock <IDataTypeService>(); dataTypeServiceMock .Setup(x => x.GetPreValuesCollectionByDataTypeId(It.IsAny <int>())) .Returns(new PreValueCollection(new Dictionary <string, PreValue> { { "key0", new PreValue(4567, "Value 1") }, { "key1", new PreValue(1234, "Value 2") }, { "key2", new PreValue(8910, "Value 3") } })); var dataTypeService = dataTypeServiceMock.Object; var editor = new PublishValuesMultipleValueEditor(false, dataTypeService, new PropertyValueEditor()); var prop = new Property(1, Guid.NewGuid(), new PropertyType(new DataTypeDefinition(1, "Test.TestEditor")), "1234,4567,8910"); var result = editor.ConvertDbToString(prop, prop.PropertyType, new Mock <IDataTypeService>().Object); Assert.AreEqual("Value 1,Value 2,Value 3", result); }