public void TestGetObjectTextSetValue() { TextValue textValue1 = new TextValue(); TextValue textValue2 = new TextValue(); textValue1.value = "value1"; textValue2.value = "value2"; SetValue setValue = new SetValue(); setValue.values = new Value[] {textValue1, textValue2}; List<object> value = PqlUtilities.GetValue(setValue) as List<object>; Assert.AreEqual(2, value.Count); Assert.True(value.Contains("value1")); Assert.True(value.Contains("value2")); }
public void TestGetTextValueCommaTextSetValue() { TextValue textValue1 = new TextValue(); TextValue textValue2 = new TextValue(); textValue1.value = "value1"; textValue2.value = "comma \",\" separated"; SetValue setValue = new SetValue(); setValue.values = new Value[] { textValue1, textValue2 }; Row row = new Row(); row.values = new Value[] { setValue }; string[] stringValues = PqlUtilities.GetRowStringValues(row); Assert.AreEqual(1, stringValues.Length); Assert.AreEqual("value1,\"comma \"\",\"\" separated\"", stringValues[0]); }
public void TestGetTextValueNumberSetValue() { NumberValue numberValue1 = new NumberValue(); NumberValue numberValue2 = new NumberValue(); numberValue1.value = "1"; numberValue2.value = "2"; SetValue setValue = new SetValue(); setValue.values = new Value[] { numberValue1, numberValue2 }; Row row = new Row(); row.values = new Value[] { setValue }; string[] stringValues = PqlUtilities.GetRowStringValues(row); Assert.AreEqual(1, stringValues.Length); Assert.AreEqual("1,2", stringValues[0]); }
public void TestGetObjectNestedSetValue() { SetValue setValue = new SetValue(); SetValue innerSetValue = new SetValue(); TextValue textValue = new TextValue(); textValue.value = "value1"; innerSetValue.values = new Value[] { textValue }; setValue.values = new Value[] {innerSetValue}; PqlUtilities.GetValue(setValue); }
public void TestGetObjectMixedSetValue() { TextValue textValue = new TextValue(); DateValue dateValue = new DateValue(); textValue.value = "value1"; Date date = new Date(); date.year = 2012; date.month = 12; date.day = 2; dateValue.value = date; SetValue setValue = new SetValue(); setValue.values = new Value[] { textValue, dateValue }; PqlUtilities.GetValue(setValue); }
public void TestGetObjectDateTimeSetValue() { DateTime dateTime = new DateTime(); Date date = new Date(); date.year = 2012; date.month = 12; date.day = 2; dateTime.date = date; dateTime.hour = 12; dateTime.minute = 45; dateTime.second = 0; dateTime.timeZoneID = "Asia/Shanghai"; DateTimeValue dateTimeValue = new DateTimeValue(); dateTimeValue.value = dateTime; SetValue setValue = new SetValue(); setValue.values = new Value[] { dateTimeValue }; List<object> value = PqlUtilities.GetValue(setValue) as List<object>; Assert.AreEqual(1, value.Count); Assert.True(value.Contains(dateTime)); }
public void TestGetObjectDateSetValue() { DateTime dateTime = new DateTime(); Date date = new Date(); date.year = 2012; date.month = 12; date.day = 2; DateValue dateValue = new DateValue(); dateValue.value = date; SetValue setValue = new SetValue(); setValue.values = new Value[] { dateValue }; List<object> value = PqlUtilities.GetValue(setValue) as List<object>; Assert.AreEqual(1, value.Count); Assert.True(value.Contains(date)); }
public void TestGetObjectNumberSetValue() { NumberValue numberValue1 = new NumberValue(); NumberValue numberValue2 = new NumberValue(); numberValue1.value = "1"; numberValue2.value = "2"; SetValue setValue = new SetValue(); setValue.values = new Value[] { numberValue1, numberValue2 }; List<object> value = PqlUtilities.GetValue(setValue) as List<object>; Assert.AreEqual(2, value.Count); Assert.True(value.Contains("1")); Assert.True(value.Contains("2")); }