public void GivenAMissingPipe_WhenSendingAndProxyCompleted()
        {
            _nextPipe = new Mock <IPipe <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> > >();
            _proxy    = new Mock <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> >();
            _proxy.SetupGet(m => m.IsCompleted).Returns(true);
            _consumeContextFactory = new Mock <IDocumentDbSagaConsumeContextFactory>();
            _mockDocumentClient    = new Mock <IDocumentClient>();
            _context = new Mock <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> >();
            _consumeContextFactory.Setup(m => m.Create(_mockDocumentClient.Object, "", "", _context.Object, It.IsAny <SimpleSaga>(), false, null)).Returns(_proxy.Object);

            _pipe = new MissingPipe <SimpleSaga, InitiateSimpleSaga>(_mockDocumentClient.Object, "", "", _nextPipe.Object, _consumeContextFactory.Object, null);

            TaskUtil.Await(() => _pipe.Send(_context.Object));
        }
        public void GivenAMissingPipe_WhenSendingAndProxyCompleted()
        {
            _collection = new Mock<IMongoCollection<SimpleSaga>>();
            _nextPipe = new Mock<IPipe<SagaConsumeContext<SimpleSaga, InitiateSimpleSaga>>>();
            _proxy = new Mock<SagaConsumeContext<SimpleSaga, InitiateSimpleSaga>>();
            _proxy.SetupGet(m => m.IsCompleted).Returns(true);
            _consumeContextFactory = new Mock<IMongoDbSagaConsumeContextFactory>();
            _context = new Mock<SagaConsumeContext<SimpleSaga, InitiateSimpleSaga>>();
            _consumeContextFactory.Setup(m => m.Create(_collection.Object, _context.Object, _context.Object.Saga, false)).Returns(_proxy.Object);

            _pipe = new MissingPipe<SimpleSaga, InitiateSimpleSaga>(_collection.Object, _nextPipe.Object, _consumeContextFactory.Object);

            TaskUtil.Await(() => _pipe.Send(_context.Object));
        }
        public void GivenAMissingPipe_WhenSendingAndProxyCompleted()
        {
            _collection = new Mock <IMongoCollection <SimpleSaga> >();
            _nextPipe   = new Mock <IPipe <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> > >();
            _proxy      = new Mock <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> >();
            _proxy.SetupGet(m => m.IsCompleted).Returns(true);
            _consumeContextFactory = new Mock <IMongoDbSagaConsumeContextFactory>();
            _context = new Mock <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> >();
            _consumeContextFactory.Setup(m => m.Create(_collection.Object, _context.Object, _context.Object.Saga, false)).Returns(_proxy.Object);

            _pipe = new MissingPipe <SimpleSaga, InitiateSimpleSaga>(_collection.Object, _nextPipe.Object, _consumeContextFactory.Object);

            TaskUtil.Await(() => _pipe.Send(_context.Object));
        }
        public void GivenAMissingPipe_WhenSendingAndProxyIncomplete()
        {
            IMongoCollection<SimpleSaga> collection = SagaRepository.Instance.GetCollection<SimpleSaga>("sagas");
            _nextPipe = new Mock<IPipe<SagaConsumeContext<SimpleSaga, InitiateSimpleSaga>>>();
            _proxy = new Mock<SagaConsumeContext<SimpleSaga, InitiateSimpleSaga>>();
            _proxy.SetupGet(m => m.IsCompleted).Returns(false);
            _consumeContextFactory = new Mock<IMongoDbSagaConsumeContextFactory>();
            _saga = new SimpleSaga {CorrelationId = Guid.NewGuid()};
            _context = new Mock<SagaConsumeContext<SimpleSaga, InitiateSimpleSaga>>();
            _context.SetupGet(m => m.Saga).Returns(_saga);
            _consumeContextFactory.Setup(m => m.Create(collection, _context.Object, _context.Object.Saga, false)).Returns(_proxy.Object);

            _pipe = new MissingPipe<SimpleSaga, InitiateSimpleSaga>(collection, _nextPipe.Object, _consumeContextFactory.Object);

            TaskUtil.Await(() => _pipe.Send(_context.Object));
        }
        public async Task GivenAMissingPipe_WhenSendingAndProxyIncomplete()
        {
            _nextPipe = new Mock <IPipe <SagaConsumeContext <SimpleSagaResource, InitiateSimpleSaga> > >();
            _proxy    = new Mock <SagaConsumeContext <SimpleSagaResource, InitiateSimpleSaga> >();
            _proxy.SetupGet(m => m.IsCompleted).Returns(false);
            _consumeContextFactory = new Mock <IDocumentDbSagaConsumeContextFactory>();
            _saga = new SimpleSagaResource {
                CorrelationId = Guid.NewGuid()
            };
            _context = new Mock <SagaConsumeContext <SimpleSagaResource, InitiateSimpleSaga> >();
            _context.SetupGet(m => m.Saga).Returns(_saga);
            _consumeContextFactory.Setup(m => m.Create(SagaRepository.Instance.Client, SagaRepository.DatabaseName, SagaRepository.CollectionName, _context.Object, It.IsAny <SimpleSagaResource>(), false, null)).Returns(_proxy.Object);

            _pipe = new MissingPipe <SimpleSagaResource, InitiateSimpleSaga>(SagaRepository.Instance.Client, SagaRepository.DatabaseName, SagaRepository.CollectionName, _nextPipe.Object, _consumeContextFactory.Object, null);

            await _pipe.Send(_context.Object);
        }
Beispiel #6
0
        public async Task GivenAMissingPipe_WhenSendingAndProxyIncomplete()
        {
            var collection = SagaRepository.Instance.GetCollection <SimpleSaga>("sagas");

            _nextPipe = new Mock <IPipe <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> > >();
            _proxy    = new Mock <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> >();
            _proxy.SetupGet(m => m.IsCompleted).Returns(false);
            _consumeContextFactory = new Mock <IMongoDbSagaConsumeContextFactory>();
            _saga = new SimpleSaga {
                CorrelationId = Guid.NewGuid()
            };
            _context = new Mock <SagaConsumeContext <SimpleSaga, InitiateSimpleSaga> >();
            _context.SetupGet(m => m.Saga).Returns(_saga);
            _consumeContextFactory.Setup(m => m.Create(collection, _context.Object, _context.Object.Saga, false)).Returns(_proxy.Object);

            _pipe = new MissingPipe <SimpleSaga, InitiateSimpleSaga>(collection, _nextPipe.Object, _consumeContextFactory.Object);

            await _pipe.Send(_context.Object);
        }