public RavenCommandStoreEmptyWhenSearchedTests() { helper = new RavenDbTestHelper(); helper.CreateFreshTestDatabase(); commandStore = new RavenDbCommandStore(new Raven.Client.Documents.DocumentStore() { Urls = RavenDbTestHelper.RavenDbSettings.NodeUrls, Database = RavenDbTestHelper.RavenDbSettings.TestDatabaseName }); _raisedCommand = new MyCommand { Value = "Value" }; }
private static IServiceProvider BuildServiceProvider(IAmACommandStore commandStore, IConfiguration Configuration) { var serviceCollection = new ServiceCollection(); serviceCollection.AddScoped <BetRegistrationCommandHandler>(); var commandSourcingHandler = new CommandSourcingHandler <BetRegistrationCommand>(commandStore); serviceCollection.Add(new ServiceDescriptor(typeof(CommandSourcingHandler <BetRegistrationCommand>), p => commandSourcingHandler, ServiceLifetime.Transient)); serviceCollection.AddDbContext <BetStatusTrackerContext>(options => options.UseLazyLoadingProxies() .UseSqlServer(Configuration.GetConnectionString("DbConnection"))); return(serviceCollection.BuildServiceProvider()); }
public OnceOnlyAttributeTests() { _commandstore = new InMemoryCommandStore(); var registry = new SubscriberRegistry(); registry.Register <MyCommand, MyStoredCommandHandler>(); var container = new TinyIoCContainer(); var handlerFactory = new TinyIocHandlerFactory(container); container.Register <IHandleRequests <MyCommand>, MyStoredCommandHandler>(); container.Register(_commandstore); _command = new MyCommand { Value = "My Test String" }; _commandProcessor = new CommandProcessor(registry, handlerFactory, new InMemoryRequestContextFactory(), new PolicyRegistry()); }
public CommandProcessorUsingCommandStoreTests() { _commandstore = new InMemoryCommandStore(); var registry = new SubscriberRegistry(); registry.Register <MyCommand, MyStoredCommandHandler>(); registry.Register <MyCommandToFail, MyStoredCommandToFailHandler>(); var container = new TinyIoCContainer(); var handlerFactory = new TinyIocHandlerFactory(container); container.Register <IHandleRequests <MyCommand>, MyStoredCommandHandler>(); container.Register(_commandstore); _command = new MyCommand { Value = "My Test String" }; _contextKey = typeof(MyStoredCommandHandler).FullName; _commandProcessor = new CommandProcessor(registry, handlerFactory, new InMemoryRequestContextFactory(), new PolicyRegistry()); }
/// <summary> /// Initializes a new instance of the <see cref="RequestHandler{TRequest}" /> class. /// </summary> /// <param name="commandStore">The store for commands that pass into the system</param> public CommandSourcingHandler(IAmACommandStore commandStore) { _commandStore = commandStore; }
/// <summary> /// Initializes a new instance of the <see cref="RequestHandler{TRequest}" /> class. /// </summary> /// <param name="commandStore">The store for commands that pass into the system</param> /// <param name="logger">The logger.</param> public CommandSourcingHandler(IAmACommandStore commandStore, ILog logger) : base(logger) { _commandStore = commandStore; }
/// <summary> /// Initializes a new instance of the <see cref="RequestHandler{TRequest}" /> class. /// </summary> /// <param name="commandStore">The store for commands that pass into the system</param> public CommandSourcingHandler(IAmACommandStore commandStore) : this(commandStore, LogProvider.GetCurrentClassLogger()) { }
/// <summary> /// Initializes a new instance of the <see cref="RequestHandler{TRequest}" /> class. /// </summary> /// <param name="commandStore">The store for commands that pass into the system</param> public CommandSourcingHandler(IAmACommandStore commandStore) : this(commandStore, LogProvider.For <CommandSourcingHandler <T> >()) { }