28 lines
553 B
Go
28 lines
553 B
Go
|
package simulationdto_test
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"joylink.club/bj-rtsts-server/dto/request_proto"
|
||
|
)
|
||
|
|
||
|
func TestTurnoutOperationReqDto(t *testing.T) {
|
||
|
b, err := json.Marshal(&request_proto.TurnoutOperationReq{
|
||
|
SimulationId: "1",
|
||
|
MapId: 2,
|
||
|
DeviceId: "3",
|
||
|
Operation: 2,
|
||
|
})
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
var o request_proto.TurnoutOperationReq
|
||
|
err = json.Unmarshal(b, &o)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
assert.Equal(t, request_proto.Turnout_Operation(2), o.Operation)
|
||
|
}
|