public void ThenIsSentToAllAzureSignalRUsers_ShouldAddAzureSignalRPipelineModule( [Values] bool isHubMethodNameNull ) { AzureSignalRPipelineModuleConfig config = null; _pipelineMock .Setup(x => x.AddModule <AzureSignalRPipelineModule, AzureSignalRPipelineModuleConfig>(It.IsAny <AzureSignalRPipelineModuleConfig>())) .Callback <AzureSignalRPipelineModuleConfig>(x => config = x) .Verifiable(); var hubMethodName = isHubMethodNameNull ? null : HubMethodName; _eventPipelineConfigurator.ThenIsSentToAllAzureSignalRUsers(HubName, hubMethodName); AssertThatHubNameAndHubMethodNamesAreCorrect(isHubMethodNameNull, config); Assert.That( config, Has.Property(nameof(AzureSignalRPipelineModuleConfig.PublicationMethod)).EqualTo(PublicationMethod.Broadcast) ); Assert.That( config, Has.Property(nameof(AzureSignalRPipelineModuleConfig.ReceiverIdsProviderAction)).Null ); }
public void ThenIsSentToAzureSignalRGroups_ShouldAddAzureSignalRPipelineModule( [Values] bool isHubMethodNameNull ) { AzureSignalRPipelineModuleConfig config = null; _pipelineMock .Setup(x => x.AddModule <AzureSignalRPipelineModule, AzureSignalRPipelineModuleConfig>(It.IsAny <AzureSignalRPipelineModuleConfig>())) .Callback <AzureSignalRPipelineModuleConfig>(x => config = x) .Verifiable(); string[] GroupIdsProviderAction(TestEvent args) => new[] { "" }; var hubMethodName = isHubMethodNameNull ? null : HubMethodName; _eventPipelineConfigurator.ThenIsSentToAzureSignalRGroups(GroupIdsProviderAction, HubName, hubMethodName); AssertThatHubNameAndHubMethodNamesAreCorrect(isHubMethodNameNull, config); Assert.That( config, Has.Property(nameof(AzureSignalRPipelineModuleConfig.PublicationMethod)).EqualTo(PublicationMethod.Group) ); Assert.That( config, Has.Property(nameof(AzureSignalRPipelineModuleConfig.ReceiverIdsProviderAction)).Not.Null ); }
private static void AssertThatHubNameAndHubMethodNamesAreCorrect(bool isHubMethodNameNull, AzureSignalRPipelineModuleConfig config) { var expectedHubMethodName = isHubMethodNameNull ? nameof(TestEvent) : HubMethodName; Assert.That( config, Has.Property(nameof(AzureSignalRPipelineModuleConfig.HubMethodName)).EqualTo(expectedHubMethodName) ); Assert.That( config, Has.Property(nameof(AzureSignalRPipelineModuleConfig.HubName)).EqualTo(HubName) ); }
public void SetUp() { _azureSignalRClientMock = new Mock <IEventSendingService>(MockBehavior.Strict); _serviceProviderMock = new Mock <IServiceProvider>(MockBehavior.Strict); _eventsScopeMock = new Mock <IEventsScope>(MockBehavior.Strict); _azureSignalRPipelineModuleConfig = new AzureSignalRPipelineModuleConfig { HubMethodName = nameof(AzureSignalRPipelineModuleConfig.HubMethodName), HubName = nameof(AzureSignalRPipelineModuleConfig.HubName), PublicationMethod = PublicationMethod.User, ReceiverIdsProviderAction = e => _receiverIds }; _pipelineEvent = new PipelineEvent(typeof(object)); _pipelineContext = new PipelineContext(_pipelineEvent, _eventsScopeMock.Object, _serviceProviderMock.Object); _azureSignalRPipelineModule = new AzureSignalRPipelineModule(_azureSignalRClientMock.Object); }