public void RedisNotificationBus_WhenStop_ShouldDisconnect() { var bus = new RedisNotificationBus("localhost:6379", new InvalidationSettings()); bus.Connection = MockOfConnection.Object; var notifyTask = bus.NotifyAsync("mykey"); Assert.NotNull(notifyTask); Assert.Equal(5, notifyTask.Result); MockOfConnection.Verify(c => c.PublishAsync(Constants.DEFAULT_INVALIDATION_CHANNEL, "mykey"), Times.Once); }
public void RedisNotificationBus_WhenStart_ShouldConnectAndSubscribe() { var bus = new RedisNotificationBus("localhost:6379", new InvalidationSettings()); bus.Connection = MockOfConnection.Object; bus.Start(); MockOfConnection.Verify(c => c.Connect(), Times.Once); MockOfConnection.Verify( c => c.Subscribe(Constants.DEFAULT_INVALIDATION_CHANNEL, It.IsAny <Action <RedisChannel, RedisValue> >()), Times.Once); }