public void EntityActivityScope_WhenNewItemIsCreatedThenEditedInAReadOnlySession_EditedValuesNotPersisted()
        {
            const int initialCreditApprovedCount = 10;
            const int ammendedCreditApprovedCount = 30;

            int createdSettlementId;
            using (var session = new EntityActivityScope(CONTROLLER_POOL))
            {
                var settlement = session.Create<Settlement>();
                settlement.CreditApprovedCount = initialCreditApprovedCount;
                createdSettlementId = settlement.InternalSettlementId;
            }

            using (var session = new EntityActivityScope(CONTROLLER_POOL) { ReadOnly = true })
            {
                var settlement = session.Retrieve<Settlement>(createdSettlementId);
                settlement.CreditApprovedCount = ammendedCreditApprovedCount;
            }

            using (var session = new EntityActivityScope(CONTROLLER_POOL) { ReadOnly = true })
            {
                var settlement = session.Retrieve<Settlement>(createdSettlementId);
                Assert.AreEqual(initialCreditApprovedCount, settlement.CreditApprovedCount, "ReadOnly session saved some changes.");
            }
        }
        public void EntityActivityScope_WhenNewItemIsCreatedThenEdited_EditedValuesPersisted()
        {
            const int initialCreditApprovedCount = 10;
            const int ammendedCreditApprovedCount = 30;

            int createdSettlementId;
            using (var session = new EntityActivityScope(CONTROLLER_POOL))
            {
                var settlement = session.Create<Settlement>();
                settlement.CreditApprovedCount = initialCreditApprovedCount;
                createdSettlementId = settlement.InternalSettlementId;
            }

            using (var session = new EntityActivityScope(CONTROLLER_POOL))
            {
                var settlement = session.Retrieve<Settlement>(createdSettlementId);
                settlement.CreditApprovedCount = ammendedCreditApprovedCount;
            }

            using (var session = new EntityActivityScope(CONTROLLER_POOL) { ReadOnly = true })
            {
                var settlement = session.Retrieve<Settlement>(createdSettlementId);
                Assert.AreEqual(ammendedCreditApprovedCount, settlement.CreditApprovedCount, "Ammending a value failed. Did the session flush?");
            }
        }
        public void FullEndToEndExample()
        {
            using (var session = new EntityActivityScope(CONTROLLER_POOL))
            {
                var mandate = session.Create<ConsumerCreditCardMandate>();

                mandate.Amount = 50;
                mandate.ConsumerCreditCardId = 1;
                mandate.DonationOriginId = 1;
                mandate.DonationSourceId = 1;
                mandate.IsUkTaxPayer = true;
            }
        }