Ejemplo n.º 1
0
        public void Equals_OneStatelessAndOneWithAState()
        {
            SecurableClassDefinition orderClass      = _testHelper.CreateOrderClassDefinition();
            StatePropertyDefinition  paymentProperty = _testHelper.CreatePaymentStateProperty(orderClass);
            StateCombination         combination1    = _testHelper.CreateStateCombination(orderClass);
            StateCombination         combination2    = _testHelper.CreateStateCombination(orderClass, paymentProperty[EnumWrapper.Get(PaymentState.Paid).Name]);

            StateCombinationComparer comparer = new StateCombinationComparer();

            Assert.That(comparer.Equals(combination1, combination2), Is.False);
        }
Ejemplo n.º 2
0
        public void GetStates_OneState()
        {
            SecurableClassDefinition classDefinition = _testHelper.CreateOrderClassDefinition();
            StatePropertyDefinition  property        = _testHelper.CreatePaymentStateProperty(classDefinition);
            StateDefinition          state           = property.DefinedStates[1];
            StateCombination         combination     = _testHelper.CreateStateCombination(classDefinition, state);

            StateDefinition[] states = combination.GetStates();

            Assert.That(states.Length, Is.EqualTo(1));
            Assert.That(states[0], Is.SameAs(state));
        }
Ejemplo n.º 3
0
        public void ValidateDuringCommit()
        {
            SecurableClassDefinition orderClass      = _testHelper.CreateOrderClassDefinition();
            StatePropertyDefinition  paymentProperty = _testHelper.CreatePaymentStateProperty(orderClass);
            StateDefinition          paidState       = paymentProperty[EnumWrapper.Get(PaymentState.Paid).Name];
            StateDefinition          notPaidState    = paymentProperty[EnumWrapper.Get(PaymentState.None).Name];

            _testHelper.CreateStateCombination(orderClass, paidState);
            _testHelper.CreateStateCombination(orderClass, notPaidState);
            _testHelper.CreateStateCombination(orderClass);
            var dupicateStateCombination = orderClass.CreateStatefulAccessControlList().StateCombinations[0];

            using (ClientTransaction.Current.CreateSubTransaction().EnterDiscardingScope())
            {
                dupicateStateCombination.AttachState(paidState);

                ClientTransaction.Current.Commit();
            }
        }