123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- package dao
- import (
- "context"
- "testing"
- "go-common/app/service/main/vip/model"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoCountAssociateOrder(t *testing.T) {
- convey.Convey("CountAssociateOrder", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- appID = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- count, err := d.CountAssociateOrder(c, mid, appID)
- 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.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoCountAssociateGrants(t *testing.T) {
- convey.Convey("CountAssociateGrants", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- appID = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- count, err := d.CountAssociateGrants(c, mid, appID)
- 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.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoCountGrantOrderByOutTradeNo(t *testing.T) {
- convey.Convey("CountGrantOrderByOutTradeNo", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- outTradeNo = ""
- appID = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- count, err := d.CountGrantOrderByOutTradeNo(c, outTradeNo, appID)
- 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.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoCountAssociateByMidAndMonths(t *testing.T) {
- convey.Convey("CountAssociateByMidAndMonths", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- appID = int64(0)
- months = int32(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- count, err := d.CountAssociateByMidAndMonths(c, mid, appID, months)
- 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.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTxInsertAssociateGrantOrder(t *testing.T) {
- convey.Convey("TxInsertAssociateGrantOrder", t, func(convCtx convey.C) {
- var (
- oa = &model.VipOrderAssociateGrant{}
- c = context.Background()
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- oldtx, err := d.OldStartTx(c)
- convCtx.So(err, convey.ShouldBeNil)
- aff, err := d.TxInsertAssociateGrantOrder(oldtx, oa)
- convCtx.Convey("Then err should be nil.aff should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(aff, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTxUpdateAssociateGrantState(t *testing.T) {
- convey.Convey("TxUpdateAssociateGrantState", t, func(convCtx convey.C) {
- var (
- oa = &model.VipOrderAssociateGrant{}
- c = context.Background()
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- oldtx, err := d.OldStartTx(c)
- convCtx.So(err, convey.ShouldBeNil)
- aff, err := d.TxUpdateAssociateGrantState(oldtx, oa)
- convCtx.Convey("Then err should be nil.aff should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(aff, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAssociateGrantCountInfo(t *testing.T) {
- convey.Convey("AssociateGrantCountInfo", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- appID = int64(0)
- months = int32(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- res, err := d.AssociateGrantCountInfo(c, mid, appID, months)
- convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddAssociateGrantCount(t *testing.T) {
- convey.Convey("AddAssociateGrantCount", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- arg = &model.VipAssociateGrantCount{}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := d.AddAssociateGrantCount(c, arg)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoUpdateAssociateGrantCount(t *testing.T) {
- convey.Convey("UpdateAssociateGrantCount", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- arg = &model.VipAssociateGrantCount{}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := d.UpdateAssociateGrantCount(c, arg)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
|