package test import ( "fmt" "git.rtzhtech.cn/iss/public-lib/dto" "git.rtzhtech.cn/iss/public-lib/logic" "git.rtzhtech.cn/iss/public-lib/model" "testing" ) func TestAddActInfo(t *testing.T) { l := logic.NewActInfoLogic() in := &model.DevCpaction{} in.Actid = 1 in.Actdesc = "Actdesc" in.Cpid = 123 for i := 0; i < 10; i++ { in.ID = 0 err := l.AddActInfo(in) if err != nil { t.Errorf("TestAdd:%v\n", err) } } } func TestDelActInfo(t *testing.T) { l := logic.NewActInfoLogic() err := l.DelActInfo(2) if err != nil { t.Errorf("TestAdd:%v\n", err) } } func TestUpdateActInfo(t *testing.T) { l := logic.NewActInfoLogic() in := &model.DevCpaction{} in.ID = 3 in.Actid = 100 in.Actdesc = "Actdesc3" in.Cpid = 100 do := l.SvcCtx.DevCpaction err := l.ModifyActInfo(in, do.Actid.String(), do.Cpid.String(), do.Actdesc.String()) if err != nil { t.Errorf("TestAdd:%v\n", err) } in.ID = 4 //更新全部字段 err = l.ModifyActInfo(in) if err != nil { t.Errorf("TestAdd:%v\n", err) } } func newActInfoReq() *dto.GetActInfoReq { req := &dto.GetActInfoReq{} req.Page = 2 req.Limit = 3 req.CpId = 1 return req } func TestGetActInfo(t *testing.T) { l := logic.NewActInfoLogic() out, err := l.GetActInfo(newActInfoReq()) if err != nil { t.Errorf("TestPage:%v\n", err) } fmt.Printf("total:%d\n", out.Total) for _, v := range out.List { fmt.Println(v) } } func TestGetActInfoCount(t *testing.T) { l := logic.NewActInfoLogic() count, err := l.GetActInfoCount(newActInfoReq()) if err != nil { t.Errorf("TestPage:%v\n", err) } fmt.Println(count) }