CQRS.Tests.CQRS.EventSourcing.EventStoreSessionTests.When_fetching_history_from_the_same_instance_after_updating_an_aggregate_the_fetched_history_includes_the_new_events C# (CSharp) Метод

When_fetching_history_from_the_same_instance_after_updating_an_aggregate_the_fetched_history_includes_the_new_events() приватный Метод

        public void When_fetching_history_from_the_same_instance_after_updating_an_aggregate_the_fetched_history_includes_the_new_events()
        {
            var store = CreateStore();
            var userId = Guid.NewGuid();
            using (var session = OpenSession(store))
            {
                var user = new User();
                user.Register("[email protected]", "Password1", userId);
                session.Save(user);
                session.SaveChanges();
            }

            using (var session = OpenSession(store))
            {

                var user = session.Get<User>(userId);
                user.ChangeEmail("[email protected]");
                session.SaveChanges();

                var history = ((IEventStoreReader)session).GetHistory(user.Id);
                Assert.That(history.Count(), Is.EqualTo(2));
            }
        }