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:
Guillaume Perrot 2017-12-14 16:18:50 -08:00 коммит произвёл GitHub
Родитель 3158e17185 63d60df728
Коммит f31e9d0e85
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -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;
}