MCPcopy Create free account
hub / github.com/devfeel/dotweb / TestBinder_Bind_xml

Function TestBinder_Bind_xml

bind_test.go:110–155  ·  view source on GitHub ↗

xml

(t *testing.T)

Source from the content-addressed store, hash-verified

108
109// xml
110func TestBinder_Bind_xml(t *testing.T) {
111
112 binder := newBinder()
113
114 if binder == nil {
115 t.Error("binder can not be nil!")
116 }
117
118 // init DotServer
119 app := New()
120
121 if app == nil {
122 t.Error("app can not be nil!")
123 }
124
125 // expected
126 expected := &Person{
127 Hair: "Brown",
128 HasGlass: true,
129 Age: 10,
130 Legs: []string{"Left", "Right"},
131 }
132 param := &InitContextParam{
133 t,
134 expected,
135 "application/xml",
136 test.ToXML,
137 }
138
139 // init param
140 context := initContext(param)
141 // actual
142 person := &Person{}
143
144 err := binder.Bind(person, context)
145
146 // check error must nil
147 test.Nil(t, err)
148
149 // check expected
150 test.Equal(t, expected, person)
151
152 t.Log("person:", person)
153 t.Log("expected:", expected)
154
155}
156
157// xml
158func TestBinder_Bind_xml_error(t *testing.T) {

Callers

nothing calls this directly

Calls 7

NilFunction · 0.92
EqualFunction · 0.92
newBinderFunction · 0.85
NewFunction · 0.85
initContextFunction · 0.85
ErrorMethod · 0.65
BindMethod · 0.65

Tested by

no test coverage detected