public void Given_TestNotifications_When_AddingNotifications_Then_NotificationsAreSucessfullyAdded()
        {
            // Arrange
            var target = new TestEntity();
            var expectedNotification1 = new TestNotification {
                Id = Guid.NewGuid()
            };
            var expectedNotification2 = new TestNotification {
                Id = Guid.NewGuid()
            };

            // Act
            target.AddDomainEvents(expectedNotification1);
            target.AddDomainEvents(expectedNotification2);

            // Assert
            Assert.Collection(target.DomainEvents,
                              evnt =>
            {
                Assert.Equal(evnt, expectedNotification1);
            },
                              evnt =>
            {
                Assert.Equal(evnt, expectedNotification2);
            });
        }
        public void Given_TestNotifications_With_EventsInDomainEvents_When_ClearingNotifications_Then_NotificationsAreSucessfullyCleared()
        {
            // Arrange
            var target = new TestEntity();

            target.AddDomainEvents(new TestNotification {
                Id = Guid.NewGuid()
            });

            // Act
            target.ClearDomainEvents();

            // Assert
            Assert.Empty(target.DomainEvents);
        }
        public void Given_TestNotifications_With_NoEventsInDomainEvents_When_ClearingNotifications_Then_NullReferenceExceptionNotThrown()
        {
            // Arrange
            var target       = new TestEntity();
            var notification = new TestNotification {
                Id = Guid.NewGuid()
            };

            target.AddDomainEvents(notification);
            target.RemoveDomainEvent(notification);

            // Act
            target.ClearDomainEvents();

            // Assert
            Assert.Empty(target.DomainEvents);
        }
        public void Given_TestNotifications_With_EventsInDomainEvents_When_RemovingNotifications_Then_NotificationsAreSucessfullyRemoved()
        {
            // Arrange
            var target = new TestEntity();
            var expectedNotification = new TestNotification {
                Id = Guid.NewGuid()
            };

            target.AddDomainEvents(expectedNotification);

            // Act
            target.RemoveDomainEvent(expectedNotification);
            target.RemoveDomainEvent(expectedNotification);

            // Assert
            Assert.Empty(target.DomainEvents);
        }