private void CreateStateCombination(StatefulAccessControlList acl, StatePropertyDefinition stateProperty, StateDefinition stateDefinition) { StateCombination stateCombination = acl.CreateStateCombination(); stateProperty.AddState(stateDefinition); stateCombination.AttachState(stateDefinition); }
public void AttachState_WithoutClassDefinition() { StateCombination combination = StateCombination.NewObject(); StatePropertyDefinition property = _testHelper.CreateTestProperty(); combination.AttachState(property["Test1"]); Assert.That(combination.GetStates().Length, Is.EqualTo(1)); }
public void ClearStates() { SecurableClassDefinition classDefinition = _testHelper.CreateOrderClassDefinition(); StateCombination combination = _testHelper.CreateStateCombination(classDefinition); StatePropertyDefinition property = _testHelper.CreateTestProperty(); combination.AttachState(property["Test1"]); Assert.That(combination.GetStates(), Is.Not.Empty); combination.ClearStates(); Assert.That(combination.GetStates(), Is.Empty); }
public void AttachState_NewState() { SecurableClassDefinition classDefinition = _testHelper.CreateOrderClassDefinition(); StateCombination combination = _testHelper.CreateStateCombination(classDefinition); StatePropertyDefinition property = _testHelper.CreateTestProperty(); using (_testHelper.Transaction.CreateSubTransaction().EnterDiscardingScope()) { combination.AttachState(property["Test1"]); var states = combination.GetStates(); Assert.That(states.Length, Is.EqualTo(1)); Assert.That(states[0], Is.SameAs(property["Test1"])); } }
private StatefulAccessControlList CreateStatefulAcl(SecurableClassDefinition classDefinition, ClientTransaction transaction, params StateDefinition[] states) { using (transaction.EnterNonDiscardingScope()) { var acl = StatefulAccessControlList.NewObject(); classDefinition.StatefulAccessControlLists.Add(acl); StateCombination stateCombination = acl.CreateStateCombination(); foreach (StateDefinition state in states) { stateCombination.AttachState(state); } return(acl); } }