| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package service
- import (
- "context"
- "reflect"
- "testing"
- )
- func TestDeviceStatistics_GetDeviceStatistics(t *testing.T) {
- type fields struct {
- BaseModel BaseModel
- BaseEquipment int
- LaboratoryEquipment int
- UseTime float64
- ExperimentalData int
- }
- type args struct {
- ctx context.Context
- req *BaseModel
- }
- base := new(DeviceStatistics)
- arg := args{
- ctx: context.TODO(),
- req: &BaseModel{LaboratoryId: 1},
- }
- tests := []struct {
- name string
- fields *DeviceStatistics
- args args
- want *DeviceStatistics
- wantErr bool
- }{
- {"读取实验数据测试1", base, arg, nil, false},
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- d := &DeviceStatistics{
- BaseModel: tt.fields.BaseModel,
- BaseEquipment: tt.fields.BaseEquipment,
- LaboratoryEquipment: tt.fields.LaboratoryEquipment,
- UseTime: tt.fields.UseTime,
- ExperimentalData: tt.fields.ExperimentalData,
- }
- got, err := d.GetDeviceStatistics(tt.args.ctx, tt.args.req)
- if (err != nil) != tt.wantErr {
- t.Errorf("GetDeviceStatistics() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("GetDeviceStatistics() got = %v, want %v", got, tt.want)
- }
- })
- }
- }
|