示例#1
0
 public string GenerateTableDataScript(string tableName)
 {
     TableScriptBuilder builder = new TableScriptBuilder();
       var table = new TableDataDesc(Db.Value.Tables[tableName]);
       builder.Append(table);
       return builder.GetScript();
 }
 public void TestAppendTableData()
 {
     var tableDesc = new Mock<TableDataDesc>(It.IsAny<Table>());
       tableDesc.Protected().Setup<IEnumerable<string>>("GetSmoTableDataScript", ItExpr.IsAny<Table>())
     .Returns(Resources.TableScript.Split(Environment.NewLine.ToCharArray()));
       tableDesc.Protected().Setup<IEnumerable<string>>("GetSmoTablePrimaryColumns", ItExpr.IsAny<Table>())
     .Returns(new string[] { });
       tableDesc.CallBase = true;
       var builder = new TableScriptBuilder();
       builder.Append(tableDesc.Object);
       var script = builder.GetScript();
       Trace.WriteLine(script);
       Assert.AreEqual(Resources.MergeTableScript, script);
 }