Exemplo n.º 1
0
        public void When_wire_stored_events_loaded_and_saved_back()
        {
            var orderA = new BookOrder_V1("A");
            var orderB = new BookOrder_V1("B");
            var id     = Guid.NewGuid();

            var events = new DomainEvent[]
            {
                new EventA(id, orderA),
                new EventB(id, orderB)
            };

            _persistenceId = "testId";
            SaveWithLegacyWire(_persistenceId, events);

            _loadedEvents = LoadFromJournal(_persistenceId, 2).ToArray();

            SaveToJournal(_loadedEvents);
        }
        public void When_wire_stored_events_loaded_and_saved_back()
        {
            var orderA = new BookOrder_V1("A");
            var orderB = new BookOrder_V1("B");
            var id     = Guid.NewGuid();

            var events = new DomainEvent[]
            {
                new EventA(id, orderA),
                new EventB(id, orderB)
            };

            var persistenceId = "testId";

            GridNode_should_convert_and_upgrade_events_stored_in_legacy_wire_format.SaveWithLegacyWire(persistenceId, events);

            var loadedEvents = LoadFromJournal(persistenceId, 2).ToArray();

            Assert.NotNull(loadedEvents);
        }
Exemplo n.º 3
0
        public void GridNode_updates_objects_in_events_by_adapter()
        {
            var orderA = new BookOrder_V1("A");
            var orderB = new BookOrder_V1("B");
            var id     = Guid.NewGuid();

            var events = new DomainEvent[]
            {
                new EventA(id, orderA),
                new EventB(id, orderB)
            };

            SaveToJournal(events);

            var loadedEvents = LoadFromJournal("testId", 2).ToArray();
            var expectA      = loadedEvents.OfType <EventA>().FirstOrDefault();
            var expectB      = loadedEvents.OfType <EventB>().FirstOrDefault();

            Assert.IsInstanceOf <BookOrder_V2>(expectA?.Order);
            Assert.IsInstanceOf <BookOrder_V2>(expectB?.Order);
        }