Esempio n. 1
0
 public ScenarioHandlerSetter(TestingMessageHandlerContext <TEntity> context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     _context = context;
 }
        public void SetUp()
        {
            var eventStore = new InMemoryEventStore(new ConsoleLogger());
            var repository = new EventSourcingRepository <TEntity>(eventStore, new StrictConcurrencyMonitor(), new ConsoleLogger());
            var eventBus   = new FakeEventBus();

            Context = new TestingMessageHandlerContext <TEntity>(repository, eventBus);
        }
Esempio n. 3
0
        public ScenarioWhenSetter(TEntity entity, THandler handler, TestingMessageHandlerContext <TEntity> context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _entity  = entity;
            _handler = handler;
            _context = context;
        }
        public ScenarioAssert(TEntity entity, THandler handler, TMessage message, TestingMessageHandlerContext <TEntity> context, Func <TEntity, TMessage, IEnumerable <IEvent> > expected)
            : base(handler, message)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _entity   = entity;
            _message  = message;
            _context  = context;
            _expected = expected;
        }
        public ScenarioGivenSetter(THandler handler, TestingMessageHandlerContext <TEntity> context)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _handler = handler;
            _context = context;
        }
        public ScenarioExceptionAssert(TEntity entity, TestingMessageHandlerContext <TEntity> context, THandler handler, TMessage message)
            : base(handler, message)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            _entity  = entity;
            _context = context;
            _message = message;
        }
Esempio n. 7
0
        public TestMessageHandlerContextSession(IRepository <TEntity> repository, IEventBus eventBus, IMessage currentMessage, TestingMessageHandlerContext <TEntity> context)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            if (eventBus == null)
            {
                throw new ArgumentNullException(nameof(eventBus));
            }
            if (currentMessage == null)
            {
                throw new ArgumentNullException(nameof(currentMessage));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            _repository     = repository;
            _eventBus       = eventBus;
            _currentMessage = currentMessage;
            _context        = context;
        }
 public void TearDown()
 {
     Context = null;
 }
Esempio n. 9
0
 public static IHandlerSetter <TEntity> For <TEntity>(TestingMessageHandlerContext <TEntity> context)
     where TEntity : AggregateRoot, new()
 {
     return(new ScenarioHandlerSetter <TEntity>(context));
 }