forked from quickfixgo/quickfix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
session_id_test.go
28 lines (24 loc) · 992 Bytes
/
session_id_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package quickfix
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSessionID_String(t *testing.T) {
var testCases = []struct {
sessionID SessionID
expectedString string
}{
{SessionID{BeginString: "FIX.4.2", SenderCompID: "SND", TargetCompID: "TAR"}, "FIX.4.2:SND->TAR"},
{SessionID{BeginString: "FIX.4.2", SenderCompID: "SND", TargetCompID: "TAR", Qualifier: "BLAH"}, "FIX.4.2:SND->TAR:BLAH"},
{SessionID{BeginString: "FIX.4.2", SenderCompID: "SND", SenderSubID: "SSUB", SenderLocationID: "SLOC",
TargetCompID: "TAR", TargetSubID: "TSUB", TargetLocationID: "TLOC",
Qualifier: "BLAH"}, "FIX.4.2:SND/SSUB/SLOC->TAR/TSUB/TLOC:BLAH"},
{SessionID{BeginString: "FIX.4.2", SenderCompID: "SND", SenderLocationID: "SLOC",
TargetCompID: "TAR", TargetSubID: "TSUB", TargetLocationID: "TLOC",
}, "FIX.4.2:SND/SLOC->TAR/TSUB/TLOC"},
}
for _, tc := range testCases {
actual := tc.sessionID.String()
assert.Equal(t, tc.expectedString, actual)
}
}