Exemplo n.º 1
0
 public object Resolve(Type type)
 {
     if (type == typeof(ILogger))
     {
         return(new ConsoleLogger(new LoggerSettings(), new NullCorrelationIdHelper()));
     }
     if (type == typeof(IDependencyResolver))
     {
         return(this);
     }
     if (type == typeof(ICommandPublisher <ISingleSignOnToken>))
     {
         return(TestSingleSignOnTokenCommandPublisher);
     }
     if (type == typeof(IHandlerRegistrar) || type == typeof(IEventHandlerRegistrar) || type == typeof(ICommandHandlerRegistrar))
     {
         return(new TestHandleRegistrar());
     }
     if (type == typeof(ILogger))
     {
         return(new ConsoleLogger(new LoggerSettingsConfigurationSection(), new NullCorrelationIdHelper()));
     }
     if (type == typeof(IConfigurationManager))
     {
         return(new ConfigurationManager());
     }
     if (type == typeof(TestAggregate))
     {
         return(new TestAggregate(TestEventStore == null || !UseTestEventStoreGuid ? NewAggregateGuid ?? Guid.NewGuid() : TestEventStore.EmptyGuid));
     }
     if (type == typeof(TestSaga))
     {
         return(new TestSaga(this, TestEventStore == null || !UseTestEventStoreGuid ? NewAggregateGuid ?? Guid.NewGuid() : TestEventStore.EmptyGuid));
     }
     if (type == typeof(TestSnapshotAggregate))
     {
         return(new TestSnapshotAggregate(TestEventStore == null || !UseTestEventStoreGuid ? NewAggregateGuid ?? Guid.NewGuid() : TestEventStore.EmptyGuid));
     }
     if (type == typeof(TestAggregateDidSomethingHandler))
     {
         var handler = new TestAggregateDidSomethingHandler();
         Handlers.Add(handler);
         return(handler);
     }
     else
     {
         var handler = new TestAggregateDoSomethingHandler();
         Handlers.Add(handler);
         return(handler);
     }
 }
Exemplo n.º 2
0
 public object Resolve(Type type)
 {
     if (type == typeof(IHandlerRegistrar) || type == typeof(IEventHandlerRegistrar) || type == typeof(ICommandHandlerRegistrar))
     {
         return(new TestHandleRegistrar());
     }
     if (type == typeof(ILogger))
     {
         return(new ConsoleLogger(new LoggerSettingsConfigurationSection(), new NullCorrelationIdHelper()));
     }
     if (type == typeof(TestAggregateDidSomethingHandler))
     {
         var handler = new TestAggregateDidSomethingHandler();
         Handlers.Add(handler);
         return(handler);
     }
     else
     {
         var handler = new TestAggregateDoSomethingHandler();
         Handlers.Add(handler);
         return(handler);
     }
 }