Exemple #1
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new GroupPropertyTypeSearchService();
            IBusinessObjectClass userClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(User));

            _tenantProperty = (IBusinessObjectReferenceProperty)userClass.GetPropertyDefinition("Tenant");
            Assert.That(_tenantProperty, Is.Not.Null);
        }
Exemple #2
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new SubstitutionPropertiesSearchService();
            IBusinessObjectClass substitutionClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Substitution));

            _otherProperty = (IBusinessObjectReferenceProperty)substitutionClass.GetPropertyDefinition("SubstitutedUser");
            Assert.That(_otherProperty, Is.Not.Null);
        }
Exemple #3
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new GroupTypePropertyTypeSearchService();
            IBusinessObjectClass groupClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Group));

            _property = (IBusinessObjectReferenceProperty)groupClass.GetPropertyDefinition("GroupType");
            Assert.That(_property, Is.Not.Null);
        }
Exemple #4
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new RolePropertiesSearchService();

            IBusinessObjectClass roleClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Role));

            _positionProperty = (IBusinessObjectReferenceProperty)roleClass.GetPropertyDefinition("Position");
            Assert.That(_positionProperty, Is.Not.Null);
        }
Exemple #5
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new SubstitutionPropertiesSearchService();
            IBusinessObjectClass substitutionClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Substitution));

            _substitutedRoleProperty = (IBusinessObjectReferenceProperty)substitutionClass.GetPropertyDefinition("SubstitutedRole");
            Assert.That(_substitutedRoleProperty, Is.Not.Null);

            _user = User.FindByUserName("group0/user1");
            Assert.That(_user, Is.Not.Null);
        }
Exemple #6
0
        public override void SetUp()
        {
            base.SetUp();

            _testHelper = new OrganizationalStructureTestHelper();
            _testHelper.Transaction.EnterNonDiscardingScope();

            _searchService = new AbstractRoleDefinitionPropertyTypeSearchService();
            IBusinessObjectClass aceClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(AccessControlEntry));

            _property = (IBusinessObjectReferenceProperty)aceClass.GetPropertyDefinition("AccessControlList");
            Assert.That(_property, Is.Not.Null);
        }
Exemple #7
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new UserPropertyTypeSearchService();
            IBusinessObjectClass roleClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Role));

            _property = (IBusinessObjectReferenceProperty)roleClass.GetPropertyDefinition("User");
            Assert.That(_property, Is.Not.Null);

            var user = User.FindByUserName("group0/user1");

            Assert.That(user, Is.Not.Null);

            _tenantConstraint = new TenantConstraint(user.Tenant.GetHandle());
        }
Exemple #8
0
        public override void SetUp()
        {
            base.SetUp();

            _searchService = new GroupPropertyTypeSearchService();
            IBusinessObjectClass roleClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Role));

            _property = (IBusinessObjectReferenceProperty)roleClass.GetPropertyDefinition("Group");
            Assert.That(_property, Is.Not.Null);

            var group = Group.FindByUnqiueIdentifier("UID: group0");

            Assert.That(group, Is.Not.Null);

            _tenantConstraint = new TenantConstraint(group.Tenant.GetHandle());
        }
Exemple #9
0
        public bool MoveNext(IBusinessObjectClass currentClass)
        {
            ArgumentUtility.CheckNotNull("currentClass", currentClass);

            _isEnumerationStarted = true;
            _currentProperty      = null;

            if (!HasNext)
            {
                _isEnumerationFinished = true;
                return(false);
            }

            var propertyIdentifierAndRemainder =
                _remainingPropertyPathIdentifier.Split(
                    new[] { currentClass.BusinessObjectProvider.GetPropertyPathSeparator() }, 2, StringSplitOptions.None);

            if (propertyIdentifierAndRemainder.Length == 2)
            {
                _remainingPropertyPathIdentifier = propertyIdentifierAndRemainder[1];
            }
            else
            {
                _remainingPropertyPathIdentifier = string.Empty;
            }

            var propertyIdentifier = propertyIdentifierAndRemainder[0];
            var property           = currentClass.GetPropertyDefinition(propertyIdentifier);

            if (property == null)
            {
                HandlePropertyNotFound(currentClass, propertyIdentifier);
            }
            else if (HasNext && !(property is IBusinessObjectReferenceProperty))
            {
                HandlePropertyNotLastPropertyAndNotReferenceProperty(currentClass, property);
            }
            else
            {
                _currentProperty = property;
            }

            return(true);
        }
Exemple #10
0
        public void SearchSpecificTenants()
        {
            var property = (IBusinessObjectReferenceProperty)_aceClass.GetPropertyDefinition("SpecificTenant");

            Assert.That(property, Is.Not.Null);

            var expected = new[] { MockRepository.GenerateStub <IBusinessObject>() };

            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>()
            .AddService(typeof(TenantPropertyTypeSearchService), _searchServiceStub);
            _searchServiceStub.Stub(stub => stub.SupportsProperty(property)).Return(true);
            _searchServiceStub.Stub(stub => stub.Search(_ace, property, _searchServiceArgsStub)).Return(expected);

            Assert.That(property.SupportsSearchAvailableObjects, Is.True);

            IBusinessObject[] actual = property.SearchAvailableObjects(_ace, _searchServiceArgsStub);
            Assert.That(actual, Is.EquivalentTo(expected));
        }
Exemple #11
0
        public override void SetUp()
        {
            base.SetUp();

            _mocks = new MockRepository();
            _mockSecurityProvider = (ISecurityProvider)_mocks.StrictMock(typeof(ISecurityProvider));
            SetupResult.For(_mockSecurityProvider.IsNull).Return(false);
            _mockPrincipalProvider          = (IPrincipalProvider)_mocks.StrictMock(typeof(IPrincipalProvider));
            _stubFunctionalSecurityStrategy = _mocks.StrictMock <IFunctionalSecurityStrategy>();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _stubFunctionalSecurityStrategy);
            serviceLocator.RegisterSingle(() => _mockSecurityProvider);
            serviceLocator.RegisterSingle(() => _mockPrincipalProvider);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);

            _searchService = new RolePropertiesSearchService();

            IBusinessObjectClass roleClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Role));

            _positionProperty = (IBusinessObjectReferenceProperty)roleClass.GetPropertyDefinition("Position");
            Assert.That(_positionProperty, Is.Not.Null);
        }
        public void StandardProperty_DefaultValue()
        {
            IBusinessObjectProperty property = _classWithPropertiesMixinInstanceAsBusinessObjectClass.GetPropertyDefinition("RequiredStringProperty");

            Assert.That(_classWithPropertiesMixinInstanceAsBusinessObject.GetProperty(property), Is.Null);
        }
        public void MixedPublicProperty_DefaultValue()
        {
            IBusinessObjectProperty mixedProperty = _classWithMixedPropertiesInstanceAsBusinessObjectClass.GetPropertyDefinition("PublicMixedProperty");

            Assert.That(_classWithMixedPropertiesInstanceAsBusinessObject.GetProperty(mixedProperty), Is.Null);
        }
Exemple #14
0
        public void SearchOwningGroups()
        {
            ISearchAvailableObjectsService   searchServiceStub = MockRepository.GenerateStub <ISearchAvailableObjectsService>();
            ISearchAvailableObjectsArguments args = MockRepository.GenerateStub <ISearchAvailableObjectsArguments>();

            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);
            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>()
            .AddService(typeof(GroupPropertyTypeSearchService), searchServiceStub);
            IBusinessObjectClass             userClass           = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(User));
            IBusinessObjectReferenceProperty owningGroupProperty = (IBusinessObjectReferenceProperty)userClass.GetPropertyDefinition("OwningGroup");

            Assert.That(owningGroupProperty, Is.Not.Null);

            User user     = CreateUser();
            var  expected = new[] { MockRepository.GenerateStub <IBusinessObject> () };

            searchServiceStub.Stub(stub => stub.SupportsProperty(owningGroupProperty)).Return(true);
            searchServiceStub.Stub(stub => stub.Search(user, owningGroupProperty, args)).Return(expected);

            Assert.That(owningGroupProperty.SupportsSearchAvailableObjects, Is.True);

            IBusinessObject[] actual = owningGroupProperty.SearchAvailableObjects(user, args);
            Assert.That(actual, Is.SameAs(expected));
        }
Exemple #15
0
        public void SearchParents()
        {
            ISearchAvailableObjectsService   searchServiceStub = MockRepository.GenerateStub <ISearchAvailableObjectsService>();
            ISearchAvailableObjectsArguments args = MockRepository.GenerateStub <ISearchAvailableObjectsArguments>();

            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);
            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>()
            .AddService(typeof(TenantPropertyTypeSearchService), searchServiceStub);
            IBusinessObjectClass             tenantClass    = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Tenant));
            IBusinessObjectReferenceProperty parentProperty = (IBusinessObjectReferenceProperty)tenantClass.GetPropertyDefinition("Parent");

            Assert.That(parentProperty, Is.Not.Null);

            Tenant tenant   = TestHelper.CreateTenant("TestTenant", string.Empty);
            var    expected = new[] { MockRepository.GenerateStub <IBusinessObject> () };

            searchServiceStub.Stub(stub => stub.SupportsProperty(parentProperty)).Return(true);
            searchServiceStub.Stub(stub => stub.Search(tenant, parentProperty, args)).Return(expected);

            Assert.That(parentProperty.SupportsSearchAvailableObjects, Is.True);

            IBusinessObject[] actual = parentProperty.SearchAvailableObjects(tenant, args);
            Assert.That(actual, Is.SameAs(expected));
        }
Exemple #16
0
        public void SearchPositions()
        {
            ISearchAvailableObjectsService   searchServiceStub = MockRepository.GenerateStub <ISearchAvailableObjectsService> ();
            ISearchAvailableObjectsArguments args = MockRepository.GenerateStub <ISearchAvailableObjectsArguments> ();

            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);
            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>()
            .AddService(typeof(RolePropertiesSearchService), searchServiceStub);
            IBusinessObjectClass             roleClass        = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Role));
            IBusinessObjectReferenceProperty positionProperty = (IBusinessObjectReferenceProperty)roleClass.GetPropertyDefinition("Position");

            Assert.That(positionProperty, Is.Not.Null);

            Role role     = Role.NewObject();
            var  expected = new[] { MockRepository.GenerateStub <IBusinessObject> () };

            searchServiceStub.Stub(stub => stub.SupportsProperty(positionProperty)).Return(true);
            searchServiceStub.Stub(stub => stub.Search(role, positionProperty, args)).Return(expected);

            Assert.That(positionProperty.SupportsSearchAvailableObjects, Is.True);

            IBusinessObject[] actual = positionProperty.SearchAvailableObjects(role, args);
            Assert.That(actual, Is.SameAs(expected));
        }