order_test.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/admin/main/vip/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoOrderCount(t *testing.T) {
  9. convey.Convey("OrderCount", t, func(convCtx convey.C) {
  10. var (
  11. c = context.Background()
  12. arg = &model.ArgPayOrder{Mid: 1, OrderNo: "1"}
  13. )
  14. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  15. count, err := d.OrderCount(c, arg)
  16. convCtx.Convey("Then err should be nil.count should not be nil.", func(convCtx convey.C) {
  17. convCtx.So(err, convey.ShouldBeNil)
  18. convCtx.So(count, convey.ShouldBeGreaterThanOrEqualTo, 0)
  19. })
  20. })
  21. })
  22. }
  23. func TestDaoOrderList(t *testing.T) {
  24. convey.Convey("OrderList", t, func(convCtx convey.C) {
  25. var (
  26. c = context.Background()
  27. arg = &model.ArgPayOrder{}
  28. )
  29. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  30. res, err := d.OrderList(c, arg)
  31. convCtx.Convey("Then err should be nil.res should be nil.", func(convCtx convey.C) {
  32. convCtx.So(err, convey.ShouldBeNil)
  33. convCtx.So(res, convey.ShouldBeNil)
  34. })
  35. })
  36. })
  37. }
  38. func TestDaoSelOrder(t *testing.T) {
  39. convey.Convey("SelOrder", t, func(convCtx convey.C) {
  40. var (
  41. c = context.Background()
  42. orderNo = "2016072617212166230921"
  43. )
  44. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  45. r, err := d.SelOrder(c, orderNo)
  46. convCtx.Convey("Then err should be nil.r should not be nil.", func(convCtx convey.C) {
  47. convCtx.So(err, convey.ShouldBeNil)
  48. convCtx.So(r, convey.ShouldNotBeNil)
  49. })
  50. })
  51. })
  52. }
  53. func TestDaoAddPayOrderLog(t *testing.T) {
  54. convey.Convey("AddPayOrderLog", t, func(convCtx convey.C) {
  55. var (
  56. c = context.Background()
  57. arg = &model.PayOrderLog{}
  58. )
  59. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  60. err := d.AddPayOrderLog(c, arg)
  61. convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
  62. convCtx.So(err, convey.ShouldBeNil)
  63. })
  64. })
  65. })
  66. }