示例#1
0
        public void RemovesAccessType()
        {
            var accessType0 = AccessTypeDefinition.NewObject();
            var accessType1 = AccessTypeDefinition.NewObject();
            var accessType2 = AccessTypeDefinition.NewObject();
            var accessType3 = AccessTypeDefinition.NewObject();
            var accessType4 = AccessTypeDefinition.NewObject();

            var securableClassDefinition = SecurableClassDefinition.NewObject();

            securableClassDefinition.AddAccessType(accessType0);
            securableClassDefinition.AddAccessType(accessType1);
            securableClassDefinition.AddAccessType(accessType2);
            securableClassDefinition.AddAccessType(accessType3);
            securableClassDefinition.AddAccessType(accessType4);

            securableClassDefinition.RemoveAccessType(accessType2);

            Assert.That(securableClassDefinition.AccessTypes, Is.EqualTo(new[] { accessType0, accessType1, accessType3, accessType4 }));
            var references = new SecurableClassDefinitionWrapper(securableClassDefinition).AccessTypeReferences;

            Assert.That(((AccessTypeReference)references[0]).Index, Is.EqualTo(0));
            Assert.That(((AccessTypeReference)references[1]).Index, Is.EqualTo(1));
            Assert.That(((AccessTypeReference)references[2]).Index, Is.EqualTo(2));
            Assert.That(((AccessTypeReference)references[3]).Index, Is.EqualTo(3));
        }
示例#2
0
        public void MoveToLaterPosition()
        {
            var accessType0 = AccessTypeDefinition.NewObject();
            var accessType1 = AccessTypeDefinition.NewObject();
            var accessType2 = AccessTypeDefinition.NewObject();
            var accessType3 = AccessTypeDefinition.NewObject();
            var accessType4 = AccessTypeDefinition.NewObject();
            var securableClassDefinition = SecurableClassDefinition.NewObject();

            securableClassDefinition.AddAccessType(accessType0);
            securableClassDefinition.AddAccessType(accessType1);
            securableClassDefinition.AddAccessType(accessType2);
            securableClassDefinition.AddAccessType(accessType3);
            securableClassDefinition.AddAccessType(accessType4);

            securableClassDefinition.MoveAccessType(3, accessType1);

            Assert.That(securableClassDefinition.AccessTypes, Is.EqualTo(new[] { accessType0, accessType2, accessType3, accessType1, accessType4 }));
            var references = new SecurableClassDefinitionWrapper(securableClassDefinition).AccessTypeReferences;

            for (int i = 0; i < references.Count; i++)
            {
                Assert.That(((AccessTypeReference)references[i]).Index, Is.EqualTo(i));
            }
        }
示例#3
0
        public void AddsAccessTypes()
        {
            var accessType0 = AccessTypeDefinition.NewObject();
            var accessType1 = AccessTypeDefinition.NewObject();
            var securableClassDefinition = SecurableClassDefinition.NewObject();

            securableClassDefinition.AddAccessType(accessType0);
            securableClassDefinition.AddAccessType(accessType1);

            Assert.That(securableClassDefinition.AccessTypes, Is.EqualTo(new[] { accessType0, accessType1 }));
            var references = new SecurableClassDefinitionWrapper(securableClassDefinition).AccessTypeReferences;

            Assert.That(((AccessTypeReference)references[0]).Index, Is.EqualTo(0));
            Assert.That(((AccessTypeReference)references[1]).Index, Is.EqualTo(1));
        }