Example #1
0
        /// <summary>
        /// The problem would manifest even if the transaction was performed on the Master, it would then occur when the
        /// Slave pulls updates and tries to apply the transaction. The reason for the test to run transactions against the
        /// Slave is because it makes guarantees for when the master has to apply the transaction.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDeleteRecords()
        public virtual void ShouldDeleteRecords()
        {
            // given
            ManagedCluster cluster = ClusterRule.startCluster();

            HighlyAvailableGraphDatabase master = cluster.Master;
            HighlyAvailableGraphDatabase slave  = cluster.AnySlave;

            Relationship rel;

            using (Transaction tx = slave.BeginTx())
            {
                rel = slave.CreateNode().createRelationshipTo(slave.CreateNode(), withName("FOO"));
                tx.Success();
            }

            using (Transaction transaction = master.BeginTx())
            {
                assertNotNull(master.GetRelationshipById(rel.Id));
            }

            // when
            using (Transaction tx = slave.BeginTx())
            {
                rel.Delete();
                tx.Success();
            }

            // then - there should have been no exceptions
            slave.Shutdown();
            master.Shutdown();
        }