static async Task Main(string[] args) { // Create configuration. var config = new HubConfigurationBuilder <MessageEvent>() .AddRouter(new ConsoleRouter()) .AddPreprocessor(FilterPreprocessor <MessageEvent> .Allow(new Func <MessageEvent, bool>[] { e => e.Message.StartsWith("Important") })) .Build(); // Create and configure event hub. var hub = new Hub <MessageEvent>(); await hub.ReconfigureAsync(config, default); // Have events be forwarded to the configured routers. hub.Forward(Events); // Wait a second to allow concurrent event distribution mechanisms to complete. await hub.FlushAsync(default);
public void AllowNull_ShouldThrow_ArgumentNullException() { Assert.Throws <ArgumentNullException>(() => { FilterPreprocessor <TestRoutable> .Allow(null); }); }
public void AllowWithCatchingCondition_ShouldReturn_Routable() { FilterPreprocessor <TestRoutable> .Allow(CatchingConditions).Process(new TestRoutable()).Count().Should().Be(1); }