Esempio n. 1
0
        public void ApplyEvents_WithUnsupportedEvents_ThrowsUnapplicableEventException()
        {
            // Arrange
            var mockAggregate = new FakeAggregate();
            var stubEvents    = new List <object>
            {
                new AppliedEvent1(),
                new UnappliedEvent()
            };

            // Act
            Action applyUnapplicable = () => mockAggregate.ApplyEvents(stubEvents);

            // Assert
            Assert.Throws <UnapplicableEvent>(applyUnapplicable);
        }
Esempio n. 2
0
        public void ApplyEvents_WithSupportedEvents_AppliesEvents()
        {
            // Arrange
            var mockAggregate = new FakeAggregate();
            var mockEvents    = new List <object>
            {
                new AppliedEvent1(),
                new AppliedEvent2()
            };

            // Act
            mockAggregate.ApplyEvents(mockEvents);

            // Assert
            Assert.Equal(mockEvents, mockAggregate.applied_events);
        }