本文整理汇总了C#中TableSchema.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# TableSchema.Delete方法的具体用法?C# TableSchema.Delete怎么用?C# TableSchema.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableSchema
的用法示例。
在下文中一共展示了TableSchema.Delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SchemaIndicesShouldAlwaysIncrease
public void SchemaIndicesShouldAlwaysIncrease()
{
//initialize table with 5 cols
var table = new TableSchema("T",
new FieldSchema("C1"),
new FieldSchema("C2"),
new FieldSchema("C3"),
new FieldSchema("C4"),
new FieldSchema("C5")
);
Assert.IsNotNull(table);
Assert.AreEqual(5, table.Count);
Assert.AreEqual(5, table.Counter);
CollectionAssert.AreEquivalent(new[] { "C1", "C2", "C3", "C4", "C5" }, table.Keys);
Assert.AreEqual(1, table["C1"].Index);
Assert.AreEqual(2, table["C2"].Index);
Assert.AreEqual(3, table["C3"].Index);
Assert.AreEqual(4, table["C4"].Index);
Assert.AreEqual(5, table["C5"].Index);
//add 2 cols
table.Insert(new FieldSchema("C6"), new FieldSchema("C7"));
Assert.AreEqual(7, table.Count);
Assert.AreEqual(7, table.Counter);
CollectionAssert.AreEquivalent(new[] { "C1", "C2", "C3", "C4", "C5", "C6", "C7" }, table.Keys);
Assert.AreEqual(1, table["C1"].Index);
Assert.AreEqual(2, table["C2"].Index);
Assert.AreEqual(3, table["C3"].Index);
Assert.AreEqual(4, table["C4"].Index);
Assert.AreEqual(5, table["C5"].Index);
Assert.AreEqual(6, table["C6"].Index);
Assert.AreEqual(7, table["C7"].Index);
//remove 3 cols
table.Delete(table["C4"], table["C5"], table["C6"]);
Assert.AreEqual(4, table.Count);
Assert.AreEqual(7, table.Counter);
CollectionAssert.AreEquivalent(new[] { "C1", "C2", "C3", "C7" }, table.Keys);
Assert.AreEqual(1, table["C1"].Index);
Assert.AreEqual(2, table["C2"].Index);
Assert.AreEqual(3, table["C3"].Index);
Assert.IsNull(table["C4"]);
Assert.IsNull(table["C5"]);
Assert.IsNull(table["C6"]);
Assert.AreEqual(7, table["C7"].Index);
//add 3 cols
table.Insert(new FieldSchema("C4"),new FieldSchema("C5"),new FieldSchema("C6"));
Assert.AreEqual(7, table.Count);
Assert.AreEqual(10, table.Counter);
CollectionAssert.AreEquivalent(new[] {"C1", "C2", "C3", "C7", "C4", "C5", "C6"}, table.Keys);
Assert.AreEqual(1, table["C1"].Index);
Assert.AreEqual(2, table["C2"].Index);
Assert.AreEqual(3, table["C3"].Index);
Assert.AreEqual(7, table["C7"].Index);
Assert.AreEqual(8, table["C4"].Index);
Assert.AreEqual(9, table["C5"].Index);
Assert.AreEqual(10, table["C6"].Index);
}