forked from Azure/azure-service-bus-go
-
Notifications
You must be signed in to change notification settings - Fork 2
/
session_test.go
47 lines (38 loc) · 1020 Bytes
/
session_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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package servicebus
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
type (
MockedBuilder struct {
mock.Mock
}
)
func (m *MockedBuilder) ManagementPath() string {
args := m.Called()
return args.String(0)
}
func (m *MockedBuilder) NewReceiver(ctx context.Context, opts ...ReceiverOption) (*Receiver, error) {
args := m.Called(ctx, opts)
return args.Get(0).(*Receiver), args.Error(1)
}
func (m *MockedBuilder) NewSender(ctx context.Context, opts ...SenderOption) (*Sender, error) {
args := m.Called(ctx, opts)
return args.Get(0).(*Sender), args.Error(1)
}
func (m *MockedBuilder) Namespace() *Namespace {
args := m.Called()
return args.Get(0).(*Namespace)
}
func (m *MockedBuilder) getEntity() *entity {
args := m.Called()
return args.Get(0).(*entity)
}
func TestQueueSession_SessionID(t *testing.T) {
builder := new(MockedBuilder)
sessionID := "123"
qs := NewQueueSession(builder, &sessionID)
assert.Equal(t, sessionID, *qs.sessionID)
}