public RetryTests() { _bus = CqrsBus .UseAssemblyFor <FakeLogger>() .AddRetry() .Build(); }
public async Task ShouldCreateBusWithoutServiceCollection() { var bus = CqrsBus.UseAssembly(typeof(FakeCommandArgs).Assembly).Build(); var args = new FakeCommandArgs(); await bus.ExecuteAsync(args); Assert.True(args.DidExecute); }
public LoggingTests() { var factory = new FakeLoggerFactory(); _logger = factory.Logger; _bus = CqrsBus .UseAssemblyFor <FakeLogger>() .AddLogging(factory) .Build(); }
public async Task ShouldUseCommandsForAssemblyContainingType() { var bus = CqrsBus.UseAssemblyFor <FakeLogger>() .Build(); var args = new FakeCommandArgs(); await bus.ExecuteAsync(args); Assert.True(args.DidExecute); }
public async Task ShouldAllowUsageOfCustomRetryPolicy() { var bus = CqrsBus .UseAssemblyFor <FakeLogger>() .AddRetry(Policy.Handle <Exception>().RetryAsync(12)) .Build(); var args = new FakeRetryCommandArgs(11); await bus.ExecuteAsync(args); Assert.Equal(12, args.TimesExecuted); }
public DecorationTests() { FakeRetryFailuresEventHandler.TimesHandled = 0; var loggerFactory = new FakeLoggerFactory(); _logger = loggerFactory.Logger; _bus = CqrsBus.UseAssemblyFor <FakeLogger>() .AddLogging(loggerFactory) .AddRetry() .Build(); }
public async Task ShouldAllowExternalServicesToBeProvided() { var instance = new SomeService(); var bus = CqrsBus.UseAssemblyFor <FakeCommandWithServiceArgs>() .AddSingleton <ISomeService>(instance) .Build(); var args = new FakeCommandWithServiceArgs(); await bus.ExecuteAsync(args); Assert.Equal(instance, args.Service); Assert.True(args.DidExecute); }
public static void Main(string[] args) { var services = new ServiceCollection().AddHttpClient(); var bus = CqrsBus .UseAssemblyFor <Program>(services) .Build(); if (args.Length != 2) { System.Console.WriteLine("You must provide a command (get)"); } if (args[0].ToLowerInvariant() == "get") { var content = bus.ExecuteAsync <string, string>(args[1]).Result; System.Console.WriteLine(content); } }
public OrganizationsController(CqrsBus bus) { _bus = bus; }
public WithdrawsController(CqrsBus bus) { _bus = bus; }
public CqrsBusTests() { _bus = CqrsBus.UseAssemblyFor <FakeCommandArgs>() .UseAssemblyFor <FakeCommandThreeArgs>() .Build(); }
public PurchasesController(CqrsBus bus) { _bus = bus; }
public CardsController(CqrsBus bus) { _bus = bus; }