Esempio n. 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;
                });
            }
Esempio n. 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;
                });
            }
Esempio n. 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);
            }
Esempio n. 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);
            }
Esempio n. 5
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(_eventSourceFactory.Object, _eventStore.Object);

                _eventSourceFactory.Setup(f => f.Create<IEventSource<Guid>>()).Returns(_eventSource.Object);
            }
Esempio n. 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;
                    });
            }
Esempio n. 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);
            }
Esempio n. 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;
                    });
            }
Esempio n. 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);
            }
Esempio n. 10
0
            protected override void Context()
            {
                _eventSourceMapper = new EventSourceMapper(_eventSourceFactory.Object, _eventStore.Object);

                _eventSourceFactory.Setup(f => f.Create <IEventSource>()).Returns(_eventSource.Object);
            }
Esempio n. 11
0
 public UnitOfWork(ICommandContextProvider commandContextProvider, IEventSourceMapper eventSourceMapper)
 {
     _commandContextProvider = commandContextProvider;
     _eventSourceMapper      = eventSourceMapper;
 }