Пример #1
0
        public static InMemoryCommandBus CreateConventionCommandBus(IDomainObjectRepository repository,
                                                                    params Assembly[] domainObjectAssemblies)
        {
            Precondition.For(repository, nameof(repository)).NotNull();

            var invoker = new ConventionCommandInvoker(repository);
            var handler = new ConventionCommandPipeline(invoker, new DomainObjectLocator(), domainObjectAssemblies);
            var bus     = new InMemoryCommandBus(handler);

            return(bus);
        }
Пример #2
0
        public void ItCallsSave()
        {
            var cmd  = new CreateCommandSecond();
            var repo = A.Fake <IDomainObjectRepository>();

            A.CallTo(() => repo.New(A <Type> .Ignored, A <string> .That.IsEqualTo(cmd.DomainObjectId)))
            .ReturnsLazily((Type x) => Activator.CreateInstance(x, "123") as IDomainObject);

            ConventionCommandPipeline sut = GetSut(repo);

            sut.ExecuteAsync(cmd);
        }
Пример #3
0
        public static InMemoryCommandBus CreateConventionCommandBus(IDomainObjectRepository repository,
                                                                    ILoggerFactory loggerFactory,
                                                                    EventSourceConfiguration configuration)
        {
            Precondition.For(repository, nameof(repository)).NotNull();
            Precondition.For(loggerFactory, nameof(loggerFactory)).NotNull();
            Precondition.For(configuration, nameof(configuration)).NotNull();

            var logger = loggerFactory.CreateLogger <InMemoryCommandBus>();

            logger.LogInformation("Building InMemory CommandBus with convention based pipeline");

            var invoker = new ConventionCommandInvoker(repository, loggerFactory);
            var handler = new ConventionCommandPipeline(invoker, new DomainObjectLocator(), loggerFactory,
                                                        configuration.DomainObjectAssemblies);

            var bus = new InMemoryCommandBus(handler, loggerFactory);

            return(bus);
        }
 public void ITCreatesTheBindings()
 {
     ConventionCommandPipeline sut = GetSut();
 }
Пример #5
0
 private ConventionCommandPipeline GetSut(IDomainObjectRepository repo)
 {
     return(ConventionCommandPipeline.CreateDefault(repo, typeof(SampleDomainObject).GetTypeInfo().Assembly));
 }