예제 #1
0
        public when_saving_memento_originator_entity()
        {
            eventStore = new Mock <IEventStore>();
            publisher  = new Mock <IEventStoreBusPublisher>();
            cache      = new MemoryCache(Guid.NewGuid().ToString());
            var sut = new AzureEventSourcedRepository <TestOriginatorEntity>(eventStore.Object, publisher.Object, new JsonTextSerializer(), new StandardMetadataProvider(), cache);

            id      = Guid.NewGuid();
            memento = Mock.Of <IMemento>();
            var entity = new TestOriginatorEntity {
                Id     = id,
                Events =
                {
                    new TestEvent {
                        SourceId = id, Version = 1, Foo = "Bar"
                    },
                    new TestEvent {
                        SourceId = id, Version = 2, Foo = "Baz"
                    }
                },
                Memento = memento
            };

            sut.Save(entity, "correlation");
        }
        public when_saving_memento_originator_entity()
        {
            this.eventStore = new Mock<IEventStore>();
            this.publisher = new Mock<IEventStoreBusPublisher>();
            this.cache = new MemoryCache(Guid.NewGuid().ToString());
            var sut = new AzureEventSourcedRepository<TestOriginatorEntity>(eventStore.Object, publisher.Object, new JsonTextSerializer(), new StandardMetadataProvider(), this.cache);
            this.id = Guid.NewGuid();
            this.memento = Mock.Of<IMemento>();
            var entity = new TestOriginatorEntity
            {
                Id = id,
                Events =
                    {
                        new TestEvent { SourceId = id, Version = 1, Foo = "Bar" },
                        new TestEvent { SourceId = id, Version = 2, Foo = "Baz" }
                    },
                Memento = memento,
            };

            sut.Save(entity, "correlation");
        }