You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
4.6 KiB

  1. using CounsellorBL;
  2. using CounsellorBL.GROUP.ConstDefinition;
  3. using OT.COM.ArsenalDB;
  4. using OT.COM.ArsenalDB.SQL;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Reflection;
  8. using System.Text;
  9. using Xunit;
  10. namespace XUnitTestProject
  11. {
  12. public class DBExportTest : DBService
  13. {
  14. readonly List<object> asOrigetkGroupName = new List<object>() { "測試團購", "TEST" };
  15. readonly List<object> asHoName = new List<object>() { "新北購好康" };
  16. readonly List<object> asWangName = new List<object>() { "省八塊揪團Go (員林地區)", "王勝天揪團Go", "好棒棒揪團GO", "省好多揪團Go (台中地區)" };
  17. readonly List<object> asLinName = new List<object>() { "海線購好康揪團GO", "鳳山購好康揪團Go", "購好康揪團go" };
  18. readonly List<object> asTestNameCur = new List<object>() { "海線購好康揪團GO", "鳳山購好康揪團Go", "購好康揪團go" };
  19. public override string MainTable => throw new NotImplementedException();
  20. private SQLLib _GetSQLLib() => new SQLLib(new MSSQLDirectSQLHelper());
  21. private long _GetCountValue(Command i_cInput)
  22. {
  23. _GetCount(i_cInput, out long o_lCount);
  24. return o_lCount;
  25. }
  26. private string _GetCount(Command i_cInput, out long o_lCount)
  27. {
  28. string sMsg = null;
  29. long lCountTemp = -1;
  30. try
  31. {
  32. do
  33. {
  34. ArsenalInterface ai = ArsenalDBMgr.GetInst(i_cInput);
  35. if (ai == null)
  36. {
  37. sMsg = "Cannot create ArsenalInterface.";
  38. break;
  39. }
  40. QueryDataSet qds = ai.RunQueryDataSet(i_cInput);
  41. if (!qds.IsSuccess)
  42. {
  43. sMsg = i_cInput.LastErrorMsg;
  44. break;
  45. }
  46. lCountTemp = qds.Total;
  47. }
  48. while (false);
  49. }
  50. catch (Exception ex)
  51. {
  52. sMsg = ex.Message;
  53. }
  54. o_lCount = lCountTemp;
  55. System.Diagnostics.Debug.WriteLine($"Count = {lCountTemp}");
  56. return sMsg;
  57. }
  58. //[Theory]
  59. // [InlineData("Gen_tb_ord_purchase_detail")]
  60. //// [InlineData("Gen2_tb_ord_incoming_return_record")]
  61. //[InlineData("Gen_tb_ord_incoming_return_record")]
  62. //[InlineData("Gen_tb_ord_checkout_list_master")]
  63. //[InlineData("Gen_tb_ord_checkout_list_detail")]
  64. //[InlineData("Gen_tb_ord_order_master")]
  65. //[InlineData("Gen_tb_ord_order_detail")]
  66. //[InlineData("Gen_tb_hr_employee2branch")]
  67. //[InlineData("Gen_tb_meb_member")]
  68. //[InlineData("Gen_tb_grp_branch")]
  69. //[InlineData("Gen_tb_grp_article")]
  70. //[InlineData("GenFBIDsSQLByGroupName")]
  71. //[InlineData("Gen_tb_grp_group")]
  72. //[InlineData("Gen_tb_meb_shopping_points_record")]
  73. //[InlineData("Gen_tb_grp_comment")]
  74. //[InlineData("Gen_tb_prd_article2product")]
  75. //[InlineData("Gen_tb_ord_purchase")]
  76. //[InlineData("Gen_tb_grp_article_media")]
  77. //[InlineData("Gen_tb_sys_uploadlog")]
  78. //[InlineData("Gen_tb_prd_product")]
  79. //[InlineData("Gen_tb_hr_employee")]
  80. //[InlineData("Gen_tb_ord_message_log")]
  81. //[InlineData("Gen_tb_ord_message_log_record")]
  82. //[InlineData("Gen_tb_grp_group2user")]
  83. //[InlineData("Gen_tb_sys_user")]
  84. //[InlineData("Gen_tb_sys_user2entercode")]
  85. //[InlineData("Gen_tb_sys_role")]
  86. //[InlineData("Gen_tb_sys_role2org")]
  87. //[InlineData("Gen_tb_sys_user2role")]
  88. //public void Count(string i_sFunctionName)
  89. //{
  90. // string sMsg = null;
  91. // long lCount = -1;
  92. // do
  93. // {
  94. // SQLLib sl = _GetSQLLib();
  95. // sMsg = sl.GetUIDs(SQLLib.Action.SELECT_ALL, i_sFunctionName, asTestNameCur, out Command cRead);
  96. // if (sMsg != null)
  97. // {
  98. // break;
  99. // }
  100. // sMsg = _GetCount(cRead, out lCount);
  101. // if (sMsg != null)
  102. // {
  103. // break;
  104. // }
  105. // if (lCount < 0)
  106. // {
  107. // sMsg = "Cannot be nagtive!";
  108. // break;
  109. // }
  110. // }
  111. // while (false);
  112. // Assert.True(sMsg == null && lCount > 0, sMsg);
  113. //}
  114. }
  115. }