123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package dao
- import (
- "context"
- "go-common/app/admin/main/vip/model"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoOrderCount(t *testing.T) {
- convey.Convey("OrderCount", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- arg = &model.ArgPayOrder{Mid: 1, OrderNo: "1"}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- count, err := d.OrderCount(c, arg)
- convCtx.Convey("Then err should be nil.count should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(count, convey.ShouldBeGreaterThanOrEqualTo, 0)
- })
- })
- })
- }
- func TestDaoOrderList(t *testing.T) {
- convey.Convey("OrderList", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- arg = &model.ArgPayOrder{}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- res, err := d.OrderList(c, arg)
- convCtx.Convey("Then err should be nil.res should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(res, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelOrder(t *testing.T) {
- convey.Convey("SelOrder", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- orderNo = "2016072617212166230921"
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- r, err := d.SelOrder(c, orderNo)
- convCtx.Convey("Then err should be nil.r should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(r, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddPayOrderLog(t *testing.T) {
- convey.Convey("AddPayOrderLog", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- arg = &model.PayOrderLog{}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := d.AddPayOrderLog(c, arg)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
|