app-cloudep-trade-service/internal/usecase/order_test.go

264 lines
5.6 KiB
Go

package usecase
import (
"app-cloudep-trade-service/internal/domain/usecase"
model "app-cloudep-trade-service/internal/model/mongo"
"context"
"reflect"
"testing"
)
func TestNewOrderUseCase(t *testing.T) {
type args struct {
param OrderUseCaseParam
}
tests := []struct {
name string
args args
want usecase.OrderUseCase
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := NewOrderUseCase(tt.args.param); !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewOrderUseCase() = %v, want %v", got, tt.want)
}
})
}
}
func TestOrderUseCase_CancelOrder(t *testing.T) {
type fields struct {
OrderModel model.OrderModel
}
type args struct {
ctx context.Context
param usecase.CancelOrderQuery
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &OrderUseCase{
OrderModel: tt.fields.OrderModel,
}
if err := o.CancelOrder(tt.args.ctx, tt.args.param); (err != nil) != tt.wantErr {
t.Errorf("CancelOrder() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func TestOrderUseCase_CreateOrder(t *testing.T) {
type fields struct {
OrderModel model.OrderModel
}
type args struct {
ctx context.Context
param usecase.CreateOrderReq
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &OrderUseCase{
OrderModel: tt.fields.OrderModel,
}
if err := o.CreateOrder(tt.args.ctx, tt.args.param); (err != nil) != tt.wantErr {
t.Errorf("CreateOrder() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func TestOrderUseCase_DeleteOrder(t *testing.T) {
type fields struct {
OrderModel model.OrderModel
}
type args struct {
ctx context.Context
param usecase.DeleteOrderQuery
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &OrderUseCase{
OrderModel: tt.fields.OrderModel,
}
if err := o.DeleteOrder(tt.args.ctx, tt.args.param); (err != nil) != tt.wantErr {
t.Errorf("DeleteOrder() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func TestOrderUseCase_GetOrder(t *testing.T) {
type fields struct {
OrderModel model.OrderModel
}
type args struct {
ctx context.Context
param usecase.GetOrderQuery
}
tests := []struct {
name string
fields fields
args args
want *usecase.GetOrderResp
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &OrderUseCase{
OrderModel: tt.fields.OrderModel,
}
got, err := o.GetOrder(tt.args.ctx, tt.args.param)
if (err != nil) != tt.wantErr {
t.Errorf("GetOrder() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("GetOrder() got = %v, want %v", got, tt.want)
}
})
}
}
func TestOrderUseCase_ListOrder(t *testing.T) {
type fields struct {
OrderModel model.OrderModel
}
type args struct {
ctx context.Context
param usecase.GetOrderListReq
}
tests := []struct {
name string
fields fields
args args
want *usecase.ListOrderResp
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &OrderUseCase{
OrderModel: tt.fields.OrderModel,
}
got, err := o.ListOrder(tt.args.ctx, tt.args.param)
if (err != nil) != tt.wantErr {
t.Errorf("ListOrder() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("ListOrder() got = %v, want %v", got, tt.want)
}
})
}
}
func TestOrderUseCase_ModifyOrderStatus(t *testing.T) {
type fields struct {
OrderModel model.OrderModel
}
type args struct {
ctx context.Context
param *usecase.ModifyOrderQuery
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &OrderUseCase{
OrderModel: tt.fields.OrderModel,
}
if err := o.ModifyOrderStatus(tt.args.ctx, tt.args.param); (err != nil) != tt.wantErr {
t.Errorf("ModifyOrderStatus() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func TestOrderUseCase_OrderStatusTimeout(t *testing.T) {
type fields struct {
OrderModel model.OrderModel
}
type args struct {
ctx context.Context
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &OrderUseCase{
OrderModel: tt.fields.OrderModel,
}
if err := o.OrderStatusTimeout(tt.args.ctx); (err != nil) != tt.wantErr {
t.Errorf("OrderStatusTimeout() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func TestOrderUseCase_convertOrdersToResponses(t *testing.T) {
type fields struct {
OrderModel model.OrderModel
}
type args struct {
orders []model.Order
}
tests := []struct {
name string
fields fields
args args
want []*usecase.GetOrderResp
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
o := &OrderUseCase{
OrderModel: tt.fields.OrderModel,
}
if got := o.convertOrdersToResponses(tt.args.orders); !reflect.DeepEqual(got, tt.want) {
t.Errorf("convertOrdersToResponses() = %v, want %v", got, tt.want)
}
})
}
}