public async Task TestCancellation() { var endpoint = new StalledEndpoint("id"); IEndpointExecutor executor = await Factory.CreateAsync(endpoint, null); Task running = executor.Invoke(Default, 0, 3600); await executor.CloseAsync(); await running; Assert.True(running.IsCompleted); }
public void SmokeTest() { var endpoint = new StalledEndpoint("id1"); IProcessor processor = endpoint.CreateProcessor(); Assert.Equal(endpoint, processor.Endpoint); Assert.True(processor.ErrorDetectionStrategy.IsTransient(new Exception())); Assert.Equal(string.Empty, endpoint.IotHubName); var cts = new CancellationTokenSource(); Task <ISinkResult <IMessage> > result = processor.ProcessAsync(new IMessage[] { }, cts.Token); Assert.False(result.IsCompleted); Assert.False(result.IsCanceled); Assert.False(result.IsFaulted); cts.Cancel(); Assert.True(result.IsCompleted); Assert.True(result.IsCanceled); Assert.False(result.IsFaulted); }
public Processor(StalledEndpoint endpoint) { this.endpoint = endpoint; }