Contact / Mail folder interfaces (2) (#659)
Added 2 interfaces for future abstractions.
This commit is contained in:
parent
09cc2769d9
commit
2ceafd8d62
42
src/internal/connector/exchange/iterators_test.go
Normal file
42
src/internal/connector/exchange/iterators_test.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package exchange
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/internal/connector/mockconnector"
|
||||||
|
"github.com/alcionai/corso/internal/connector/support"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ExchangeIteratorSuite struct {
|
||||||
|
suite.Suite
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestExchangeIteratorSuite(t *testing.T) {
|
||||||
|
suite.Run(t, new(ExchangeIteratorSuite))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *ExchangeIteratorSuite) TestDisplayable() {
|
||||||
|
t := suite.T()
|
||||||
|
bytes := mockconnector.GetMockContactBytes("Displayable")
|
||||||
|
contact, err := support.CreateContactFromBytes(bytes)
|
||||||
|
require.NoError(t, err)
|
||||||
|
aDisplayable, ok := contact.(displayable)
|
||||||
|
assert.True(t, ok)
|
||||||
|
assert.NotNil(t, aDisplayable.GetId())
|
||||||
|
assert.NotNil(t, aDisplayable.GetDisplayName())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *ExchangeIteratorSuite) TestDescendable() {
|
||||||
|
t := suite.T()
|
||||||
|
bytes := mockconnector.GetMockMessageBytes("Descendable")
|
||||||
|
message, err := support.CreateMessageFromBytes(bytes)
|
||||||
|
require.NoError(t, err)
|
||||||
|
aDescendable, ok := message.(descendable)
|
||||||
|
assert.True(t, ok)
|
||||||
|
assert.NotNil(t, aDescendable.GetId())
|
||||||
|
assert.NotNil(t, aDescendable.GetParentFolderId())
|
||||||
|
}
|
||||||
@ -18,6 +18,20 @@ const (
|
|||||||
eventsCategory = "events"
|
eventsCategory = "events"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// descendable represents objects that implement msgraph-sdk-go/models.entityable
|
||||||
|
// and have the concept of a "parent folder".
|
||||||
|
type descendable interface {
|
||||||
|
GetId() *string
|
||||||
|
GetParentFolderId() *string
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayable represents objects that implement msgraph-sdk-fo/models.entityable
|
||||||
|
// and have the concept of a display name.
|
||||||
|
type displayable interface {
|
||||||
|
GetId() *string
|
||||||
|
GetDisplayName() *string
|
||||||
|
}
|
||||||
|
|
||||||
// GraphIterateFuncs are iterate functions to be used with the M365 iterators (e.g. msgraphgocore.NewPageIterator)
|
// GraphIterateFuncs are iterate functions to be used with the M365 iterators (e.g. msgraphgocore.NewPageIterator)
|
||||||
// @returns a callback func that works with msgraphgocore.PageIterator.Iterate function
|
// @returns a callback func that works with msgraphgocore.PageIterator.Iterate function
|
||||||
type GraphIterateFunc func(
|
type GraphIterateFunc func(
|
||||||
Loading…
x
Reference in New Issue
Block a user