Ejemplo n.º 1
0
        public void MultipleEventsInSameClass()
        {
            var item = new SimpleEventEntity
            {
                Name = "PageType #1"
            };

            SimpleEntityMultiEventListener.Counter = 0;
            Repository.Data.Save(item);
            Assert.Equal(110, SimpleEntityMultiEventListener.Counter);
        }
Ejemplo n.º 2
0
        public void LongRunningPreEvent()
        {
            var item = new SimpleEventEntity
            {
                Name = "Created should be aborted"
            };

            Assert.Throws <TransactionManagerCommunicationException>(() => Repository.Data.Save(item));

            ConversationHelper.ReOpen();

            var item2 = Repository.Data.Get <SimpleEventEntity>(item.Id);

            Assert.Null(item2);
        }
Ejemplo n.º 3
0
        public void LongRunningPreAsyncEvent()
        {
            var item = new SimpleEventEntity
            {
                Name = "AsyncCreated should not be aborted since event is handled asynchronously"
            };

            Repository.Data.Save(item);

            ConversationHelper.ReOpen();

            var item2 = Repository.Data.Get <SimpleEventEntity>(item.Id);

            Assert.NotNull(item2);
        }
Ejemplo n.º 4
0
        public void ChangeNameInEvent()
        {
            var item = new SimpleEventEntity
            {
                Name = "ChangeMe #1"
            };

            Repository.Data.Save(item);
            Assert.Equal("ChangeMe #1 create created", item.Name);

            ConversationHelper.ReOpen();

            var item2 = Repository.Data.Get <SimpleEventEntity>(item.Id);

            Assert.Equal("ChangeMe #1 create", item2.Name);
        }
Ejemplo n.º 5
0
        public void ChangeNameInEventCheckInsertAndUpdateCount()
        {
            var statistics = IoC.Resolve <ISessionFactory>().Statistics;

            statistics.Clear();

            var item = new SimpleEventEntity
            {
                Name = "ChangeMe #1"
            };

            Repository.Data.Save(item);
            Assert.Equal("ChangeMe #1 create created", item.Name);

            Assert.Equal(1, statistics.EntityInsertCount);
            Assert.Equal(0, statistics.EntityUpdateCount);
        }