rts-sim-testing-service/dto/simulation_dto/turnout_test.go

28 lines
553 B
Go
Raw Normal View History

2023-10-13 17:43:48 +08:00
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)
}