本文整理汇总了C#中Index.GetUpScript方法的典型用法代码示例。如果您正苦于以下问题:C# Index.GetUpScript方法的具体用法?C# Index.GetUpScript怎么用?C# Index.GetUpScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index.GetUpScript方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIndexWithOneColumn_GetValidCreateScript
public void CreateIndexWithOneColumn_GetValidCreateScript()
{
// Arrange
var index = new Index<MyTable>("MyIndexName", "MyTable");
// Act
index.AddColumn(m => m.MyColumn);
// Assert
Assert.Equal(1, index.GetUpScript().Count);
Assert.Equal("CREATE INDEX MyIndexName \r\nON MyTable(MyColumn)\r\n", index.GetUpScript().First());
}
示例2: CreateIndexWithTwoColumns_GetValidCreateScript
public void CreateIndexWithTwoColumns_GetValidCreateScript()
{
// Arrange
var index = new Index("MyIndexName", "MyTable");
// Act
index.AddColumn("MyColumn");
index.AddColumn("MyOtherColumn");
// Assert
Assert.Equal(1, index.GetUpScript().Count);
Assert.Equal(2, index.Columns.Count);
Assert.Equal("CREATE INDEX MyIndexName \r\nON MyTable(MyColumn, MyOtherColumn)\r\n", index.GetUpScript().First());
}
示例3: TryToGetUpScriptOnIndexWithNoColumnsAdded_GetExceptionWithFaultMessage
public void TryToGetUpScriptOnIndexWithNoColumnsAdded_GetExceptionWithFaultMessage()
{
// Arrange
var index = new Index("Name", "MyTable");
// Act & Assert
var ex = Assert.Throws<InvalidOperationException>(() => index.GetUpScript());
Assert.Equal("No columns is added to index Name for table MyTable", ex.Message);
}