Merge pull request #556 from Microsoft/fix/channel-group-factory
Add parameter for channel group factory so that wrapper sdks can use …
This commit is contained in:
Коммит
f31e9d0e85
|
@ -332,9 +332,9 @@ namespace Microsoft.AppCenter
|
|||
}
|
||||
_appSecret = GetSecretForPlatform(appSecretOrSecrets, PlatformIdentifier);
|
||||
|
||||
// If a factory has been supplied, use it to construct the channel group - this is designed for testing.
|
||||
// If a factory has been supplied, use it to construct the channel group - this is useful for wrapper SDKs and testing.
|
||||
_networkStateAdapter = new NetworkStateAdapter();
|
||||
_channelGroup = _channelGroupFactory?.CreateChannelGroup(_appSecret) ?? new ChannelGroup(_appSecret, null, _networkStateAdapter);
|
||||
_channelGroup = _channelGroupFactory?.CreateChannelGroup(_appSecret, _networkStateAdapter) ?? new ChannelGroup(_appSecret, null, _networkStateAdapter);
|
||||
_channel = _channelGroup.AddChannel(ChannelName, Constants.DefaultTriggerCount, Constants.DefaultTriggerInterval,
|
||||
Constants.DefaultTriggerMaxParallelRequests);
|
||||
if (_logUrl != null)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
namespace Microsoft.AppCenter.Channel
|
||||
using Microsoft.AppCenter.Ingestion.Http;
|
||||
|
||||
namespace Microsoft.AppCenter.Channel
|
||||
{
|
||||
public interface IChannelGroupFactory
|
||||
{
|
||||
IChannelGroup CreateChannelGroup(string appSecret);
|
||||
IChannelGroup CreateChannelGroup(string appSecret, INetworkStateAdapter networkState);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.AppCenter.Channel;
|
||||
using Microsoft.AppCenter.Ingestion.Http;
|
||||
using Moq;
|
||||
|
||||
namespace Microsoft.AppCenter.Test.Channel
|
||||
|
@ -12,7 +13,7 @@ namespace Microsoft.AppCenter.Test.Channel
|
|||
_channelGroupMock = channelGroupMock;
|
||||
}
|
||||
|
||||
public IChannelGroup CreateChannelGroup(string appSecret)
|
||||
public IChannelGroup CreateChannelGroup(string appSecret, INetworkStateAdapter networkState)
|
||||
{
|
||||
return _channelGroupMock.Object;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче