| 1 |
package element |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
|
| 6 |
"github.com/mitch000001/go-hbci/domain" |
| 7 |
) |
| 8 |
|
| 9 |
func TestAccountConnectionUnmarshalHBCI(t *testing.T) { |
| 10 |
test := "abc:subacc:280:12345678" |
| 11 |
|
| 12 |
acc := &AccountConnectionDataElement{} |
| 13 |
|
| 14 |
err := acc.UnmarshalHBCI([]byte(test)) |
| 15 |
|
| 16 |
if err != nil { |
| 17 |
t.Logf("Expected no error, got %T:%v\n", err, err) |
| 18 |
t.Fail() |
| 19 |
} |
| 20 |
|
| 21 |
expected := NewAccountConnection( |
| 22 |
domain.AccountConnection{ |
| 23 |
AccountID: "abc", |
| 24 |
SubAccountCharacteristics: "subacc", |
| 25 |
CountryCode: 280, |
| 26 |
BankID: "12345678", |
| 27 |
}, |
| 28 |
).String() |
| 29 |
actual := acc.String() |
| 30 |
|
| 31 |
if expected != actual { |
| 32 |
t.Logf("Expected unmarshaled value to equal\n%q\n\tgot\n%q\n", expected, actual) |
| 33 |
t.Fail() |
| 34 |
} |
| 35 |
} |