public void Value_Editor_Can_Convert_To_Json_Object_For_Editor(string value, bool isOk) { var prop = new Property(1, new PropertyType(Mock.Of <IShortStringHelper>(), "test", ValueStorageType.Nvarchar)); prop.SetValue(value); DataValueEditor valueEditor = MockedValueEditors.CreateDataValueEditor(ValueTypes.String); object result = valueEditor.ToEditor(prop); Assert.AreEqual(isOk, !(result is string)); }
public void Value_Editor_Can_Serialize_Decimal_Value_With_Empty_String() { DataValueEditor valueEditor = MockedValueEditors.CreateDataValueEditor(ValueTypes.Decimal); var prop = new Property(1, new PropertyType(Mock.Of <IShortStringHelper>(), "test", ValueStorageType.Decimal)); prop.SetValue(string.Empty); object result = valueEditor.ToEditor(prop); Assert.AreEqual(string.Empty, result); }
[TestCase(ValueTypes.DateTime, "", "")] // test empty string for date public void Value_Editor_Can_Serialize_Value(string valueType, object val, string expected) { var prop = new Property(1, new PropertyType(Mock.Of <IShortStringHelper>(), "test", ValueStorageType.Nvarchar)); prop.SetValue(val); DataValueEditor valueEditor = MockedValueEditors.CreateDataValueEditor(valueType); object result = valueEditor.ToEditor(prop); Assert.AreEqual(expected, result); }
public void Value_Editor_Can_Serialize_Date_Value() { DateTime now = DateTime.Now; DataValueEditor valueEditor = MockedValueEditors.CreateDataValueEditor(ValueTypes.Date); var prop = new Property(1, new PropertyType(Mock.Of <IShortStringHelper>(), "test", ValueStorageType.Date)); prop.SetValue(now); object result = valueEditor.ToEditor(prop); Assert.AreEqual(now.ToIsoString(), result); }
public void Value_Editor_Can_Serialize_Decimal_Value() { decimal value = 12.34M; DataValueEditor valueEditor = MockedValueEditors.CreateDataValueEditor(ValueTypes.Decimal); var prop = new Property(1, new PropertyType(Mock.Of <IShortStringHelper>(), "test", ValueStorageType.Decimal)); prop.SetValue(value); object result = valueEditor.ToEditor(prop); Assert.AreEqual("12.34", result); }
public void Value_Editor_Can_Convert_To_Json_Object_For_Editor(string value, bool isOk) { var prop = new Property(1, new PropertyType("test", ValueStorageType.Nvarchar)); prop.SetValue(value); var valueEditor = new DataValueEditor { ValueType = ValueTypes.String }; var result = valueEditor.ToEditor(prop, new Mock <IDataTypeService>().Object); Assert.AreEqual(isOk, !(result is string)); }
public void Value_Editor_Can_Serialize_Decimal_Value_With_Empty_String() { var valueEditor = new DataValueEditor { ValueType = ValueTypes.Decimal }; var prop = new Property(1, new PropertyType("test", ValueStorageType.Decimal)); prop.SetValue(string.Empty); var result = valueEditor.ToEditor(prop, new Mock <IDataTypeService>().Object); Assert.AreEqual(string.Empty, result); }
[TestCase(ValueTypes.DateTime, "", "")] //test empty string for date public void Value_Editor_Can_Serialize_Value(string valueType, object val, string expected) { var prop = new Property(1, new PropertyType("test", ValueStorageType.Nvarchar)); prop.SetValue(val); var valueEditor = new DataValueEditor { ValueType = valueType }; var result = valueEditor.ToEditor(prop, new Mock <IDataTypeService>().Object); Assert.AreEqual(expected, result); }
public void Value_Editor_Can_Serialize_Date_Value() { var now = DateTime.Now; var valueEditor = new DataValueEditor { ValueType = ValueTypes.Date }; var prop = new Property(1, new PropertyType("test", ValueStorageType.Date)); prop.SetValue(now); var result = valueEditor.ToEditor(prop, new Mock <IDataTypeService>().Object); Assert.AreEqual(now.ToIsoString(), result); }
public void Value_Editor_Can_Serialize_Decimal_Value() { var value = 12.34M; var valueEditor = new DataValueEditor { ValueType = ValueTypes.Decimal }; var prop = new Property(1, new PropertyType("test", ValueStorageType.Decimal)); prop.SetValue(value); var result = valueEditor.ToEditor(prop, new Mock <IDataTypeService>().Object); Assert.AreEqual("12.34", result); }