示例#1
0
        public void WhenDomainActionPerformed_ThenObjectHasEvents()
        {
            var root = new TestRoot();

            root.Publish(5);

            Assert.True(root.GetEvents().Any());

            root.AcceptEvents();

            Assert.False(root.GetEvents().Any());
        }
示例#2
0
        public void WhenDomainActionPerformed_ThenRootChangesStateThroughEvent()
        {
            var root = new TestRoot();

            root.Publish(5);

            Assert.Equal(5, root.LatestVersion);
            Assert.True(root.GetChanges().Any());
            Assert.True(root.GetChanges().OfType <TestPublished>().Any(x => x.Version == 5));

            root.AcceptChanges();

            Assert.False(root.GetChanges().Any());
        }