123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package service
- import (
- "fmt"
- "testing"
- "xiaoniaokuaiyan.com/xiaoniao/dal"
- "xiaoniaokuaiyan.com/xiaoniao/entity"
- )
- func TestAddCoupon(t *testing.T) {
- coupon := &entity.DiscountTicket{
- TypeId: 1,
- Mobile: "18310412106",
- Value: 100.0,
- Deadline: "2016-05-16",
- }
- srv := &CouponService{
- ICoupon: dal.DefaultCouponDal,
- }
- ret, err := srv.AddCoupon(coupon)
- if err != nil {
- t.Fatal(err)
- }
- fmt.Println(ret)
- }
- func TestListCoupon(t *testing.T) {
- srv := &CouponService{
- ICoupon: dal.DefaultCouponDal,
- }
- ret, err := srv.ListCoupon("13810833508", 1, 1, 10)
- if err != nil {
- t.Fatal(err)
- }
- fmt.Println(ret)
- }
- func TestExchangeCode(t *testing.T) {
- srv := &CouponService{
- ICoupon: dal.DefaultCouponDal,
- }
- ret, err := srv.Exchange("xxxxx", 4, "18310412106")
- if err != nil {
- t.Fatal(err)
- }
- fmt.Println(ret)
- }
|