public void TestAddNullDescriptor() { var services = new ServiceCollection(); var builder = new CamundaWorkerBuilder(services); Assert.Throws <ArgumentNullException>(() => builder.AddHandlerDescriptor(null)); }
public void TestAddDescriptor() { var services = new ServiceCollection(); Task FakeHandlerDelegate(IExternalTaskContext context) => Task.CompletedTask; var builder = new CamundaWorkerBuilder(services); builder.AddHandlerDescriptor(new HandlerDescriptor(FakeHandlerDelegate, new HandlerMetadata(new[] { "testTopic" }))); Assert.Contains(services, d => d.Lifetime == ServiceLifetime.Singleton && d.ImplementationInstance != null); }