本文整理汇总了C#中MainViewModel.AsDynamic方法的典型用法代码示例。如果您正苦于以下问题:C# MainViewModel.AsDynamic方法的具体用法?C# MainViewModel.AsDynamic怎么用?C# MainViewModel.AsDynamic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainViewModel
的用法示例。
在下文中一共展示了MainViewModel.AsDynamic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateUpdateStatementTest
public void CreateUpdateStatementTest()
{
var vm = new MainViewModel();
var testCase = new[] {
new { Input = new { TableName = "TEST", Colums = new[] { "A" } },
Answer = "update TEST set A = @a" },
new { Input = new { TableName = "TEST", Colums = new[] { "A", "B" } },
Answer = "update TEST set A = @a, B = @b" },
new { Input = new { TableName = "TEST", Colums = new[] { "A", "Index" } },
Answer = "update TEST set A = @a, 'Index' = @index" }
};
foreach (var test in testCase)
{
var result = (string)vm.AsDynamic().CreateUpdateStatement(test.Input.TableName, test.Input.Colums);
result.Is(test.Answer);
}
}
示例2: CreateInsertStatementTest
public void CreateInsertStatementTest()
{
var vm = new MainViewModel();
var testCase = new[] {
new { Input = new { TableName = "TEST", Colums = new[] { "A" } },
Answer = "insert into TEST (A) values (@a)" },
new { Input = new { TableName = "TEST", Colums = new[] { "A", "B" } },
Answer = "insert into TEST (A, B) values (@a, @b)" },
new { Input = new { TableName = "TEST", Colums = new[] { "A", "Index" } },
Answer = "insert into TEST (A, 'Index') values (@a, @index)" }
};
foreach (var test in testCase)
{
var result = (string)vm.AsDynamic().CreateInsertStatement(test.Input.TableName, test.Input.Colums);
result.Is(test.Answer);
}
}
示例3: CreateSelectStatementTest
public void CreateSelectStatementTest()
{
var vm = new MainViewModel();
var testCase = new[] {
new { Input = new { TableName = "TEST", Colums = new[] { "A" }, Limit = 0 },
Answer = "select A from TEST"},
new { Input = new { TableName = "TEST", Colums = new[] { "A", "B" } , Limit = 0},
Answer = "select A, B from TEST"},
new { Input = new { TableName = "TEST", Colums = new[] { "A", "Index" } , Limit = 0},
Answer = "select A, 'Index' from TEST"},
new { Input = new { TableName = "TEST", Colums = new[] { "A", "B" } , Limit = 10},
Answer = "select first(10) A, B from TEST" },
new { Input = new { TableName = "TEST", Colums = new[] { "A", "B" } , Limit = 1000},
Answer = "select first(1000) A, B from TEST" }
};
foreach (var test in testCase)
{
var result = (string)vm.AsDynamic().CreateSelectStatement(test.Input.TableName, test.Input.Colums, test.Input.Limit);
result.Is(test.Answer);
}
}