mysql_advance_test.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoAdvanceType(t *testing.T) {
  8. convey.Convey("AdvanceType", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. cid = int64(0)
  12. mid = int64(0)
  13. mode = ""
  14. )
  15. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  16. typ, err := testDao.AdvanceType(c, cid, mid, mode)
  17. ctx.Convey("Then err should be nil.typ should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. ctx.So(typ, convey.ShouldNotBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestDaoAdvance(t *testing.T) {
  25. convey.Convey("Advance", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. mid = int64(0)
  29. id = int64(0)
  30. )
  31. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  32. testDao.Advance(c, mid, id)
  33. })
  34. })
  35. }
  36. func TestDaoAdvances(t *testing.T) {
  37. convey.Convey("Advances", t, func(ctx convey.C) {
  38. var (
  39. c = context.Background()
  40. owner = int64(0)
  41. )
  42. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  43. res, err := testDao.Advances(c, owner)
  44. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. ctx.So(res, convey.ShouldNotBeNil)
  47. })
  48. })
  49. })
  50. }
  51. func TestDaoBuyAdvance(t *testing.T) {
  52. convey.Convey("BuyAdvance", t, func(ctx convey.C) {
  53. var (
  54. c = context.Background()
  55. mid = int64(0)
  56. cid = int64(0)
  57. owner = int64(0)
  58. refund = int64(0)
  59. typ = ""
  60. mode = ""
  61. )
  62. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  63. id, err := testDao.BuyAdvance(c, mid, cid, owner, refund, typ, mode)
  64. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  65. ctx.So(err, convey.ShouldBeNil)
  66. ctx.So(id, convey.ShouldNotBeNil)
  67. })
  68. })
  69. })
  70. }
  71. func TestDaoUpdateAdvType(t *testing.T) {
  72. convey.Convey("UpdateAdvType", t, func(ctx convey.C) {
  73. var (
  74. c = context.Background()
  75. id = int64(0)
  76. typ = ""
  77. )
  78. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  79. affect, err := testDao.UpdateAdvType(c, id, typ)
  80. ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
  81. ctx.So(err, convey.ShouldBeNil)
  82. ctx.So(affect, convey.ShouldNotBeNil)
  83. })
  84. })
  85. })
  86. }
  87. func TestDaoDelAdvance(t *testing.T) {
  88. convey.Convey("DelAdvance", t, func(ctx convey.C) {
  89. var (
  90. c = context.Background()
  91. id = int64(0)
  92. )
  93. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  94. affect, err := testDao.DelAdvance(c, id)
  95. ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
  96. ctx.So(err, convey.ShouldBeNil)
  97. ctx.So(affect, convey.ShouldNotBeNil)
  98. })
  99. })
  100. })
  101. }
  102. func TestDaoAdvanceCmt(t *testing.T) {
  103. convey.Convey("AdvanceCmt", t, func(ctx convey.C) {
  104. var (
  105. c = context.Background()
  106. oid = int64(0)
  107. mid = int64(0)
  108. mode = ""
  109. )
  110. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  111. adv, err := testDao.AdvanceCmt(c, oid, mid, mode)
  112. ctx.Convey("Then err should be nil.adv should not be nil.", func(ctx convey.C) {
  113. ctx.So(err, convey.ShouldBeNil)
  114. ctx.So(adv, convey.ShouldNotBeNil)
  115. })
  116. })
  117. })
  118. }