示例#1
0
        public void SetProvider_FromOtherBusinessObjectImplementation()
        {
            OtherBusinessObjectImplementationProvider provider = new OtherBusinessObjectImplementationProvider();

            BusinessObjectProvider.SetProvider(typeof(OtherBusinessObjectImplementationProviderAttribute), provider);
            Assert.That(BusinessObjectProvider.GetProvider(typeof(OtherBusinessObjectImplementationProviderAttribute)), Is.SameAs(provider));
        }
示例#2
0
 public void SetProvider_Null()
 {
     BusinessObjectProvider.SetProvider(typeof(StubBusinessObjectProviderAttribute), _provider);
     BusinessObjectProvider.SetProvider(typeof(StubBusinessObjectProviderAttribute), null);
     Assert.That(BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute)), Is.Not.SameAs(_provider));
     Assert.That(BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute)), Is.TypeOf(typeof(StubBusinessObjectProvider)));
 }
        public void GetProviderForBindableObjectType()
        {
            BindableObjectProvider provider = BindableObjectProvider.GetProviderForBindableObjectType(typeof(SimpleBusinessObjectClass));

            Assert.That(provider, Is.Not.Null);
            Assert.That(provider, Is.SameAs(BusinessObjectProvider.GetProvider(typeof(BindableObjectProviderAttribute))));
        }
示例#4
0
        public void SearchSubstitutedRoles()
        {
            var searchServiceStub = MockRepository.GenerateStub <ISearchAvailableObjectsService> ();
            var args = MockRepository.GenerateStub <ISearchAvailableObjectsArguments> ();

            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);
            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute> ().AddService(
                typeof(SubstitutionPropertiesSearchService), searchServiceStub);
            var substitutionClass       = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(Substitution));
            var substitutedRoleProperty = (IBusinessObjectReferenceProperty)substitutionClass.GetPropertyDefinition("SubstitutedRole");

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

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

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

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

            var actual = substitutedRoleProperty.SearchAvailableObjects(substitution, args);

            Assert.That(actual, Is.SameAs(expected));
        }
示例#5
0
        public void GetProvider()
        {
            IBusinessObjectProvider provider = BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute));

            Assert.That(provider, Is.TypeOf(typeof(StubBusinessObjectProvider)));
            Assert.That(((BusinessObjectProvider)provider).ProviderAttribute, Is.TypeOf(typeof(StubBusinessObjectProviderAttribute)));
        }
示例#6
0
        private static void SetObjectStorageProvider(string objectPath)
        {
            var provider = new XmlReflectionBusinessObjectStorageProvider(objectPath);

            XmlReflectionBusinessObjectStorageProvider.SetCurrent(provider);
            BusinessObjectProvider.GetProvider <BindableObjectWithIdentityProviderAttribute>().AddService(typeof(IGetObjectService), provider);
        }
        public void GetProviderForBindableObjectType_WithIdentityType()
        {
            BindableObjectProvider provider = BindableObjectProvider.GetProviderForBindableObjectType(typeof(ClassWithIdentity));

            Assert.That(provider, Is.Not.Null);
            Assert.That(provider, Is.SameAs(BusinessObjectProvider.GetProvider(typeof(BindableObjectWithIdentityProviderAttribute))));
            Assert.That(provider, Is.Not.SameAs(BusinessObjectProvider.GetProvider(typeof(BindableObjectProviderAttribute))));
        }
示例#8
0
 public void GetProvider_WithMixin()
 {
     using (MixinConfiguration.BuildNew().ForClass(typeof(StubBusinessObjectProvider)).AddMixin <MixinStub>().EnterScope())
     {
         IBusinessObjectProvider provider = BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute));
         Assert.That(provider, Is.InstanceOf(typeof(IMixinTarget)));
     }
 }
示例#9
0
        public void GetProvider_WithDifferentAttributesResultingInDifferentProviders()
        {
            IBusinessObjectProvider provider = BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute));

            Assert.That(provider, Is.TypeOf(typeof(StubBusinessObjectProvider)));
            Assert.That(provider, Is.Not.SameAs(BusinessObjectProvider.GetProvider(typeof(Stub2BusinessObjectProviderAttribute))));
            Assert.That(provider, Is.Not.SameAs(BusinessObjectProvider.GetProvider(typeof(DerivedStubBusinessObjectProviderAttribute))));
        }
示例#10
0
 public void GetProvider()
 {
     Assert.That(
         BindableObjectProvider.GetProviderForBindableObjectType(typeof(ClassDerivedFromBindableObjectBase)),
         Is.SameAs(BusinessObjectProvider.GetProvider <BindableObjectProviderAttribute>()));
     Assert.That(
         BindableObjectProvider.GetProviderForBindableObjectType(typeof(ClassDerivedFromBindableObjectBase)),
         Is.Not.SameAs(BusinessObjectProvider.GetProvider <BindableObjectWithIdentityProviderAttribute>()));
 }
        public void GetProviderForBindableObjectType_WithAttributeFromTypeOverridingAttributeFromMixin()
        {
            BindableObjectProvider provider =
                BindableObjectProvider.GetProviderForBindableObjectType(typeof(DerivedBusinessObjectClassWithSpecificBusinessObjectProviderAttribute));

            Assert.That(provider, Is.Not.Null);
            Assert.That(provider, Is.SameAs(BusinessObjectProvider.GetProvider(typeof(BindableObjectWithIdentityProviderAttribute))));
            Assert.That(provider, Is.Not.SameAs(BusinessObjectProvider.GetProvider(typeof(BindableObjectProviderAttribute))));
        }
示例#12
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            _searchServiceStub     = MockRepository.GenerateStub <ISearchAvailableObjectsService>();
            _searchServiceArgsStub = MockRepository.GenerateStub <ISearchAvailableObjectsArguments>();
            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);
            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>().AddService(
                typeof(ISearchAvailableObjectsService), MockRepository.GenerateStub <ISearchAvailableObjectsService>());
        }
示例#13
0
        public void GetFromUniqueIdentifier()
        {
            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>().AddService(typeof(IGetObjectService), new BindableDomainObjectGetObjectService());
            SampleBindableMixinDomainObject original = SampleBindableMixinDomainObject.NewObject();

            var provider = BindableObjectProvider.GetProviderForBindableObjectType(typeof(SampleBindableMixinDomainObject));
            var boClass  = (BindableObjectClassWithIdentity)provider.GetBindableObjectClass(typeof(SampleBindableMixinDomainObject));

            Assert.That(boClass.GetObject(original.ID.ToString()), Is.SameAs(original));
        }
示例#14
0
        public void SearchSpecificGroups()
        {
            var property = (IBusinessObjectReferenceProperty)_aceClass.GetPropertyDefinition("SpecificGroup");

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

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

            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>()
            .AddService(typeof(GroupPropertyTypeSearchService), _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));
        }
示例#15
0
        public override void SetUp()
        {
            base.SetUp();

            _searchServiceTestHelper = new SearchServiceTestHelper();
            _stubbedQueryID          = "FakeQuery";

            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>().AddService(
                typeof(ISearchAvailableObjectsService), new BindableDomainObjectCompoundSearchService());

            _clientTransaction = _searchServiceTestHelper.CreateStubbableTransaction <ClientTransaction>();
            _transactionScope  = _clientTransaction.EnterDiscardingScope();

            var fakeResultData = _searchServiceTestHelper.CreateFakeResultData(_clientTransaction);

            _searchServiceTestHelper.StubQueryResult(_stubbedQueryID, new[] { fakeResultData });

            var referencingObject = SampleBindableMixinDomainObject.NewObject();

            _referencingBusinessObject = (IBusinessObject)referencingObject;
            _property = (IBusinessObjectReferenceProperty)_referencingBusinessObject.BusinessObjectClass.GetPropertyDefinition("Relation");
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Type                itemType     = GetType();
            PropertyInfo        propertyInfo = itemType.GetProperty("ConformanceLevel");
            EnumerationProperty property     = new EnumerationProperty(
                new PropertyBase.Parameters(
                    (BindableObjectProvider)BusinessObjectProvider.GetProvider <BindableObjectProviderAttribute>(),
                    PropertyInfoAdapter.Create(propertyInfo),
                    propertyInfo.PropertyType,
                    new Lazy <Type> (() => propertyInfo.PropertyType),
                    null,
                    false,
                    false,
                    new BindableObjectDefaultValueStrategy(),
                    SafeServiceLocator.Current.GetInstance <IBindablePropertyReadAccessStrategy>(),
                    SafeServiceLocator.Current.GetInstance <IBindablePropertyWriteAccessStrategy>(),
                    SafeServiceLocator.Current.GetInstance <BindableObjectGlobalizationService>()));

            WaiConformanceLevelField.Property = property;
            WaiConformanceLevelField.LoadUnboundValue(ConformanceLevel, IsPostBack);
        }
示例#17
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));
        }
示例#18
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));
        }
示例#19
0
        public void SearchGroupTypes()
        {
            var searchServiceStub = MockRepository.GenerateStub <ISearchAvailableObjectsService>();
            var args = MockRepository.GenerateStub <ISearchAvailableObjectsArguments>();

            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);
            BusinessObjectProvider.GetProvider <BindableDomainObjectProviderAttribute>()
            .AddService(typeof(GroupTypePropertyTypeSearchService), searchServiceStub);
            var groupTypePositionClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(GroupTypePosition));
            var groupTypeProperty      = (IBusinessObjectReferenceProperty)groupTypePositionClass.GetPropertyDefinition("GroupType");

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

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

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

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

            IBusinessObject[] actual = groupTypeProperty.SearchAvailableObjects(groupTypePosition, args);
            Assert.That(actual, Is.SameAs(expected));
        }
示例#20
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));
        }
示例#21
0
 public void GetProvider_SameTwice()
 {
     Assert.That(
         BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute)),
         Is.SameAs(BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute))));
 }
示例#22
0
        public void GetProvider_FromOtherBusinessObjectImplementation()
        {
            IBusinessObjectProvider provider = BusinessObjectProvider.GetProvider(typeof(OtherBusinessObjectImplementationProviderAttribute));

            Assert.That(provider, Is.TypeOf(typeof(OtherBusinessObjectImplementationProvider)));
        }
示例#23
0
        protected void Application_Start(Object sender, EventArgs e)
        {
            LogManager.Initialize();
            PreferQuirksModeRendering = false;
            bool useClassicBlueTheme = false;

            if (useClassicBlueTheme)
            {
                DefaultServiceLocator defaultServiceLocator = DefaultServiceLocator.Create();
                defaultServiceLocator.Register(typeof(ResourceTheme), typeof(ResourceTheme.ClassicBlue), LifetimeKind.Singleton);
                ServiceLocator.SetLocatorProvider(() => defaultServiceLocator);
            }

            string objectPath = Server.MapPath("~/objects");

            if (!Directory.Exists(objectPath))
            {
                Directory.CreateDirectory(objectPath);
            }

            XmlReflectionBusinessObjectStorageProvider provider = new XmlReflectionBusinessObjectStorageProvider(objectPath);

            XmlReflectionBusinessObjectStorageProvider.SetCurrent(provider);
            BusinessObjectProvider.GetProvider <BindableObjectWithIdentityProviderAttribute>().AddService(typeof(IGetObjectService), provider);
            BusinessObjectProvider.GetProvider <BindableObjectWithIdentityProviderAttribute>()
            .AddService(typeof(ISearchAvailableObjectsService), new BindableXmlObjectSearchService());
            BusinessObjectProvider.GetProvider <BindableObjectWithIdentityProviderAttribute>()
            .AddService(typeof(IBusinessObjectWebUIService), new ReflectionBusinessObjectWebUIService());

            BusinessObjectProvider.GetProvider <BindableObjectProviderAttribute>().AddService(new ReferenceDataSourceTestDefaultValueService());
            BusinessObjectProvider.GetProvider <BindableObjectProviderAttribute>().AddService(new ReferenceDataSourceTestDeleteObjectService());

            if (PreferQuirksModeRendering)
            {
                DefaultServiceLocator defaultServiceLocator = DefaultServiceLocator.Create();
                foreach (var entry in LegacyServiceConfigurationService.GetConfiguration())
                {
                    defaultServiceLocator.Register(entry);
                }
                foreach (var entry in BocLegacyServiceConfigurationService.GetConfiguration())
                {
                    defaultServiceLocator.Register(entry);
                }

                ServiceLocator.SetLocatorProvider(() => defaultServiceLocator);

                Assertion.IsTrue(SafeServiceLocator.Current.GetInstance <IBocListRenderer>() is BocListQuirksModeRenderer);
                Assertion.IsTrue(SafeServiceLocator.Current.GetInstance <IBocTextValueRenderer>() is BocTextValueQuirksModeRenderer);
            }

            _resourceVirtualPathProvider = new ResourceVirtualPathProvider(
                new[]
            {
                new ResourcePathMapping("Remotion.Web", @"..\..\Web\Core\res"),
                new ResourcePathMapping("Remotion.ObjectBinding.Web", @"..\..\ObjectBinding\Web\res"),
                new ResourcePathMapping("Remotion.Web.Legacy", @"..\..\Web\Legacy\res"),
                new ResourcePathMapping("Remotion.ObjectBinding.Web.Legacy", @"..\..\ObjectBinding\Web.Legacy\res")
            },
                FileExtensionHandlerMapping.Default);
            _resourceVirtualPathProvider.Register();

            //var bundle = new Bundle ("~/bundles/css");
            //foreach (var resourcePathMapping in _resourceVirtualPathProvider.Mappings)
            //  BundleCssFilesRecursively ((ResourceVirtualDirectory) _resourceVirtualPathProvider.GetDirectory(resourcePathMapping.VirtualPath), bundle);

            //BundleTable.Bundles.Add (bundle);
        }
示例#24
0
 public void FromClass()
 {
     Assert.That(_bindableObjectMixin.BusinessObjectClass, Is.Not.Null);
     Assert.That(_bindableObjectMixin.BusinessObjectClass.TargetType, Is.SameAs(typeof(SampleBindableMixinDomainObject)));
     Assert.That(_bindableObjectMixin.BusinessObjectClass.BusinessObjectProvider, Is.SameAs(BusinessObjectProvider.GetProvider(typeof(BindableDomainObjectProviderAttribute))));
 }
示例#25
0
 public void FromInterface()
 {
     Assert.That(_businessObject.BusinessObjectClass, Is.Not.Null);
     Assert.That(_businessObject.BusinessObjectClass, Is.SameAs(_bindableObjectMixin.BusinessObjectClass));
     Assert.That(_businessObject.BusinessObjectClass.BusinessObjectProvider, Is.SameAs(BusinessObjectProvider.GetProvider(typeof(BindableDomainObjectProviderAttribute))));
 }
示例#26
0
 public void SetProvider_Twice()
 {
     BusinessObjectProvider.SetProvider(typeof(StubBusinessObjectProviderAttribute), new StubBusinessObjectProvider(_serviceFactoryStub));
     BusinessObjectProvider.SetProvider(typeof(StubBusinessObjectProviderAttribute), _provider);
     Assert.That(BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute)), Is.SameAs(_provider));
 }
示例#27
0
 public void SetProvider_WithGeneric()
 {
     BusinessObjectProvider.SetProvider <StubBusinessObjectProviderAttribute> (_provider);
     Assert.That(BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute)), Is.SameAs(_provider));
 }
示例#28
0
 public void SetProvider()
 {
     BusinessObjectProvider.SetProvider(typeof(StubBusinessObjectProviderAttribute), _provider);
     Assert.That(BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute)), Is.SameAs(_provider));
     Assert.That(((BusinessObjectProvider)_provider).ProviderAttribute, Is.TypeOf(typeof(StubBusinessObjectProviderAttribute)));
 }
示例#29
0
 public void GetProvider_FromGeneric()
 {
     Assert.That(
         BusinessObjectProvider.GetProvider <StubBusinessObjectProviderAttribute>(),
         Is.SameAs(BusinessObjectProvider.GetProvider(typeof(StubBusinessObjectProviderAttribute))));
 }
示例#30
0
 private static void RegisterIconService()
 {
     BusinessObjectProvider.GetProvider <BindableObjectWithIdentityProviderAttribute>()
     .AddService(typeof(IBusinessObjectWebUIService), new ReflectionBusinessObjectWebUIService());
 }