예제 #1
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(null, _eventStore.Object);

                _commandContext.Id      = _commitId;
                _commandContext.Headers = new Dictionary <string, object> {
                    { "TestKey", "TestValue" }
                };
                _eventSource.Setup(s => s.Id).Returns(_id);
                _eventSource.Setup(s => s.Version).Returns(_version);
                _eventSource.Setup(s => s.Flush()).Returns(_events);

                _eventStore
                .Setup(s => s.Write(
                           It.IsAny <Guid>(),
                           It.IsAny <int>(),
                           It.IsAny <IEnumerable <object> >(),
                           It.IsAny <Guid>(),
                           It.IsAny <Dictionary <string, object> >(),
                           It.IsAny <Dictionary <object, Dictionary <string, object> > >()))
                .Callback <Guid, int, IEnumerable <object>, Guid, Dictionary <string, object>, Dictionary <object, Dictionary <string, object> > >((a, b, c, d, e, f) =>
                {
                    _committedHeaders      = e;
                    _committedEventHeaders = f;
                });
            }
예제 #2
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(null, _eventStore.Object);

                _commandContext.Id      = _commitId;
                _commandContext.Headers = new Dictionary <string, object> {
                    { "TestKey", "TestValue" }
                };
                _eventSource.Setup(s => s.Id).Returns(_id);
                _eventSource.Setup(s => s.StringId).Returns(_id.ToString);
                _eventSource.Setup(s => s.Version).Returns(_version);
                _eventSource.Setup(s => s.Flush()).Returns(this._events).Callback(() => _eventSource.Setup(s => s.Version).Returns(_version + _events.Count));
                _eventSource.Setup(s => s.BucketId).Returns(BucketSupport.DefaultBucketId);

                _eventStore
                .Setup(s => s.Write(
                           It.IsAny <string>(),
                           It.IsAny <string>(),
                           It.IsAny <int>(),
                           It.IsAny <IEnumerable <object> >(),
                           It.IsAny <Guid>(),
                           It.IsAny <Dictionary <string, object> >(),
                           It.IsAny <Dictionary <object, Dictionary <string, object> > >()))
                .Callback <string, string, int, IEnumerable <object>, Guid, Dictionary <string, object>, Dictionary <object, Dictionary <string, object> > >((a, b, c, d, e, f, g) =>
                {
                    _committedHeaders      = f;
                    _committedEventHeaders = g;
                });
            }
예제 #3
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(_eventSourceFactory.Object, _eventStore.Object);

                _eventSourceFactory.Setup(f => f.Create <IEventSource>()).Returns(_eventSource.Object);
                _eventSource.Setup(s => s.Id).Returns(_id);
                _eventSource.Setup(s => s.Version).Returns(_version);
                _eventStore.Setup(a => a.Read(_id)).Returns(_memento.Object);
                _eventStore.Setup(a => a.Read(_id, _version)).Returns(_events);
            }
예제 #4
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(_eventSourceFactory.Object, _eventStore.Object);

                _eventSourceFactory.Setup(f => f.Create <IEventSource <Guid> >()).Returns(_eventSource.Object);
                _eventSource.Setup(s => s.Id).Returns(_id);
                _eventSource.Setup(s => s.StringId).Returns(_id.ToString);
                _eventSource.Setup(s => s.Version).Returns(_version);
                _eventSource.Setup(s => s.BucketId).Returns(BucketSupport.DefaultBucketId);
                _eventStore.Setup(a => a.Read <Guid>(BucketSupport.DefaultBucketId, _id.ToString(), int.MaxValue)).Returns(this._memento.Object);
                _eventStore.Setup(a => a.Read(BucketSupport.DefaultBucketId, _id.ToString(), int.MaxValue)).Returns(this._events);
            }
예제 #5
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(_eventSourceFactory.Object, _eventStore.Object);

                _eventSourceFactory.Setup(f => f.Create<IEventSource<Guid>>()).Returns(_eventSource.Object);
            }
예제 #6
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(null, _eventStore.Object);

                _commandContext.Id = _commitId;
                _commandContext.Headers = new Dictionary<string, object> { { "TestKey", "TestValue" } };
                _eventSource.Setup(s => s.Id).Returns(_id);
                _eventSource.Setup(s => s.StringId).Returns(_id.ToString);
                _eventSource.Setup(s => s.Version).Returns(_version);
                _eventSource.Setup(s => s.Flush()).Returns(this._events).Callback(() => _eventSource.Setup(s => s.Version).Returns(_version + _events.Count));
                _eventSource.Setup(s => s.BucketId).Returns(BucketSupport.DefaultBucketId);

                _eventStore
                    .Setup(s => s.Write(
                        It.IsAny<string>(),
                        It.IsAny<string>(),
                        It.IsAny<int>(),
                        It.IsAny<IEnumerable<object>>(),
                        It.IsAny<Guid>(),
                        It.IsAny<Dictionary<string, object>>(),
                        It.IsAny<Dictionary<object, Dictionary<string, object>>>()))
                    .Callback<string, string, int, IEnumerable<object>, Guid, Dictionary<string, object>, Dictionary<object, Dictionary<string, object>>>((a, b, c, d, e, f, g) =>
                    {
                        _committedHeaders = f;
                        _committedEventHeaders = g;
                    });
            }
예제 #7
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(_eventSourceFactory.Object, _eventStore.Object);

                _eventSourceFactory.Setup(f => f.Create<IEventSource<Guid>>()).Returns(_eventSource.Object);
                _eventSource.Setup(s => s.Id).Returns(_id);
                _eventSource.Setup(s => s.StringId).Returns(_id.ToString);
                _eventSource.Setup(s => s.Version).Returns(_version);
                _eventSource.Setup(s => s.BucketId).Returns(BucketSupport.DefaultBucketId);
                _eventStore.Setup(a => a.Read<Guid>(BucketSupport.DefaultBucketId, _id.ToString(), int.MaxValue)).Returns(this._memento.Object);
                _eventStore.Setup(a => a.Read(BucketSupport.DefaultBucketId, _id.ToString(), int.MaxValue)).Returns(this._events);
            }
예제 #8
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(null, _eventStore.Object);

                _commandContext.Id = _commitId;
                _commandContext.Headers = new Dictionary<string, object> {{ "TestKey", "TestValue" }};
                _eventSource.Setup(s => s.Id).Returns(_id);
                _eventSource.Setup(s => s.Version).Returns(_version);
                _eventSource.Setup(s => s.Flush()).Returns(_events);

                _eventStore
                    .Setup(s => s.Write(
                        It.IsAny<Guid>(),
                        It.IsAny<int>(),
                        It.IsAny<IEnumerable<object>>(),
                        It.IsAny<Guid>(),
                        It.IsAny<Dictionary<string, object>>(),
                        It.IsAny<Dictionary<object, Dictionary<string, object>>>()))
                    .Callback<Guid, int, IEnumerable<object>, Guid, Dictionary<string, object>, Dictionary<object, Dictionary<string, object>>>((a, b, c, d, e, f) =>
                    {
                        _committedHeaders = e;
                        _committedEventHeaders = f;
                    });
            }
예제 #9
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(_eventSourceFactory.Object, _eventStore.Object);

                _eventSourceFactory.Setup(f => f.Create<IEventSource>()).Returns(_eventSource.Object);
                _eventSource.Setup(s => s.Id).Returns(_id);
                _eventSource.Setup(s => s.Version).Returns(_version);
                _eventStore.Setup(a => a.Read(_id)).Returns(_memento.Object);
                _eventStore.Setup(a => a.Read(_id, _version)).Returns(_events);
            }
예제 #10
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(_eventSourceFactory.Object, _eventStore.Object);

                _eventSourceFactory.Setup(f => f.Create <IEventSource>()).Returns(_eventSource.Object);
            }
예제 #11
0
파일: UnitOfWork.cs 프로젝트: nmigas/NES
 public UnitOfWork(ICommandContextProvider commandContextProvider, IEventSourceMapper eventSourceMapper)
 {
     _commandContextProvider = commandContextProvider;
     _eventSourceMapper      = eventSourceMapper;
 }