示例#1
0
// Test Equipment JSON marshaling
func TestJsonEquipment(t *testing.T) {
	equipment := core.NewEquipment("eqp-name", "eqp-code", "eqp-type")
	testCheckJson(t, equipment, `{"name":"eqp-name","code":"eqp-code","type":"eqp-type"}`)

	equipment.Data = "custom data"
	equipment.Id = 100
	testCheckJson(t, equipment, `{"id":100,"name":"eqp-name","code":"eqp-code","type":"eqp-type","data":"custom data"}`)
}
示例#2
0
// NewEquipment creates a new equipment.
// No user data by default.
func NewEquipment(name, code, type_ string) *core.Equipment {
	return core.NewEquipment(name, code, type_)
}