public void TestOraWriteRead_When_Guid() { IColumn col = ColumnFactory.CreateInstance(ColumnTypeName.Raw, "test_col", 16, true, "", ""); CreateTestTable1Row3Columns1Value(col, "hextoraw('3f2504e04f8911d39a0c0305e82c3301')"); WriteAndRead(); VerifyType(col); }
//TestMethod protected void TestWriteRead_When_Bool() { IColumn col = ColumnFactory.CreateInstance(ColumnTypeName.Bool, "test_col", 0, 1, 0, false, false, "0", ""); CreateTestTable1Row3Columns1Value(col, "1"); WriteAndRead(); VerifyType(col); }
//TestMethod protected void TestWriteRead_When_Int64() { IColumn col = ColumnFactory.CreateInstance(ColumnTypeName.Int64, "test_col", 0, 20, 0, false, false, "0", ""); CreateTestTable1Row3Columns1Value(col, "123456789012345"); WriteAndRead(); VerifyType(col); }
//TestMethod protected void TestWriteRead_When_LongText() { IColumn col = ColumnFactory.CreateInstance(ColumnTypeName.LongText, "test_col", -1, false, "' '", ""); CreateTestTable1Row3Columns1Value(col, "'Testing'"); WriteAndRead(); CheckString(col, "Testing"); }
public void TestMSWriteRead_When_Guid() { IColumn col = ColumnFactory.CreateInstance(ColumnTypeName.Guid, "test_col", true, ""); CreateTestTable1Row3Columns1Value(col, "'3f2504e0-4f89-11d3-9a0c-0305e82c3301'"); WriteAndRead(); VerifyType(col); }
//TestMethod protected void TestNullValue_When_Blob(Action checkValue) { IColumn col = ColumnFactory.CreateInstance(ColumnTypeName.Blob, "test_col", true, ""); CreateTestTable1Row3Columns1Value(col); WriteAndRead(); checkValue(); }
//TestMethod protected void TestNullValue_When_Float(Action checkValue) { IColumn col = ColumnFactory.CreateInstance(ColumnTypeName.Float, "test_col", 0, 30, 8, true, false, "", ""); CreateTestTable1Row3Columns1Value(col); WriteAndRead(); checkValue(); }
private void LoadColumns(XElement xml) { Columns.Clear(); var columnNodes = xml.Element("table").Element("fields").Elements("field"); foreach (XElement columnNode in columnNodes) { int columnId = int.Parse(columnNode.Attribute("id").Value); FieldType type = (FieldType)Enum.Parse(typeof(FieldType), columnNode.Attribute("field_type").Value, true); string label = columnNode.Element("label").Value; bool hidden = false; XElement hidNode = columnNode.Element("appears_by_default"); if (hidNode != null && hidNode.Value == "0") { hidden = true; } bool canAddChoices = columnNode.Element("allow_new_choices")?.Value == "1"; bool virt = false, lookup = false, summary = false; if (columnNode.Attribute("mode") != null) { string mode = columnNode.Attribute("mode").Value; virt = mode == "virtual"; lookup = mode == "lookup"; summary = mode == "summary"; } bool allowHTML = columnNode.Element("allowHTML")?.Value == "1"; IQColumn col = ColumnFactory.CreateInstance(columnId, label, type, virt, lookup, summary, hidden, canAddChoices); if (columnNode.Element("choices") != null) { foreach (XElement choicenode in columnNode.Element("choices").Elements("choice")) { object value; switch (type) { case FieldType.rating: value = Int32.Parse(choicenode.Value); break; default: value = choicenode.Value; break; } ((IQColumn_int)col).AddChoice(value, true); } } Dictionary <string, int> colComposites = ((IQColumn_int)col).GetComposites(); if (columnNode.Element("compositeFields") != null) { foreach (XElement compositenode in columnNode.Element("compositeFields").Elements("compositeField")) { colComposites.Add(compositenode.Attribute("key").Value, Int32.Parse(compositenode.Attribute("id").Value)); } } Columns.Add(col); } var keyFidNode = xml.Element("table").Element("original").Element("key_fid"); KeyFID = keyFidNode != null?Int32.Parse(keyFidNode.Value) : Columns.Find(c => c.ColumnType == FieldType.recordid).ColumnId; KeyCIdx = Columns.FindIndex(c => c.ColumnId == KeyFID); }