public override void SetUp()
        {
            base.SetUp();

            _securityProviderStub = MockRepository.GenerateStub <ISecurityProvider> ();
            _securityProviderStub.Stub(stub => stub.IsNull).Return(false);

            _securityPrincipalStub = MockRepository.GenerateStub <ISecurityPrincipal> ();
            var principalProviderStub = MockRepository.GenerateStub <IPrincipalProvider> ();

            principalProviderStub.Stub(stub => stub.GetPrincipal()).Return(_securityPrincipalStub);

            _functionalSecurityStrategyStub = MockRepository.GenerateStub <IFunctionalSecurityStrategy> ();
            _objectSecurityStrategyStub     = MockRepository.GenerateStub <IObjectSecurityStrategy> ();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _securityProviderStub);
            serviceLocator.RegisterSingle(() => principalProviderStub);
            serviceLocator.RegisterSingle(() => _functionalSecurityStrategyStub);
            serviceLocator.RegisterMultiple <IWebSecurityAdapter>();
            serviceLocator.RegisterMultiple <IWxeSecurityAdapter> (() => new WxeSecurityAdapter());
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);

            _testAccessTypeValue = AccessType.Get(TestAccessTypes.Value);
        }
        public void SetUp()
        {
            _htmlHelper      = new HtmlHelper();
            _httpContextStub = MockRepository.GenerateStub <HttpContextBase>();

            _control = MockRepository.GenerateStub <IListMenu>();
            _control.Stub(stub => stub.UniqueID).Return("MyListMenu");
            _control.Stub(stub => stub.ClientID).Return("MyListMenu");
            _control.Stub(stub => stub.ControlType).Return("ListMenu");
            _control.Stub(stub => stub.MenuItems).Return(new WebMenuItemCollection(_control));

            _control.Stub(stub => stub.Enabled).Return(true);
            _control.Stub(stub => stub.HasClientScript).Return(true);
            _control.Stub(stub => stub.ResolveClientUrl(null)).IgnoreArguments().Do((Func <string, string>)(url => url.TrimStart('~')));
            _control.Stub(stub => stub.GetUpdateScriptReference("null")).Return("Update();");

            var pageStub = MockRepository.GenerateStub <IPage>();

            _clientScriptManagerMock = MockRepository.GenerateMock <IClientScriptManager>();
            pageStub.Stub(page => page.ClientScript).Return(_clientScriptManagerMock);

            _control.Stub(stub => stub.Page).Return(pageStub);

            PopulateMenu();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle <IRenderingFeatures> (() => RenderingFeatures.WithDiagnosticMetadata);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 3
0
        public override void SetUp()
        {
            base.SetUp();

            _securityProviderStub           = MockRepository.GenerateStub <ISecurityProvider>();
            _principalProviderStub          = MockRepository.GenerateStub <IPrincipalProvider>();
            _securityPrincipalStub          = MockRepository.GenerateStub <ISecurityPrincipal>();
            _functionalSecurityStrategyStub = MockRepository.GenerateStub <IFunctionalSecurityStrategy>();

            _principalProviderStub.Stub(stub => stub.GetPrincipal()).Return(_securityPrincipalStub);

            _securityContextStub        = MockRepository.GenerateStub <ISecurityContext> ();
            _securityContextFactoryStub = MockRepository.GenerateStub <ISecurityContextFactory> ();

            _securityContextFactoryStub.Stub(mock => mock.CreateSecurityContext()).Return(_securityContextStub);

            _clientTransaction = ClientTransaction.CreateRootTransaction();
            _clientTransaction.Extensions.Add(new SecurityClientTransactionExtension());

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _securityProviderStub);
            serviceLocator.RegisterSingle(() => _principalProviderStub);
            serviceLocator.RegisterSingle(() => _functionalSecurityStrategyStub);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);

            _clientTransaction.EnterNonDiscardingScope();
        }
Ejemplo n.º 4
0
        public override void SetUp()
        {
            base.SetUp();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle <IRenderingFeatures> (() => RenderingFeatures.WithDiagnosticMetadata);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
        public override void SetUp()
        {
            base.SetUp();

            _bindablePropertyReadAccessStrategyMock = MockRepository.GenerateStrictMock <IBindablePropertyReadAccessStrategy>();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _bindablePropertyReadAccessStrategyMock);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 6
0
        public void SetupSecurityIoCConfiguration()
        {
            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _mockSecurityProvider);
            serviceLocator.RegisterSingle(() => _stubPrincipalProvider);
            serviceLocator.RegisterSingle(() => _mockMemberResolver);
            serviceLocator.RegisterSingle(() => _mockPermissionReflector);
            serviceLocator.RegisterSingle(() => _mockFunctionalSecurityStrategy);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
        public void SetUp()
        {
            _securityAdapter = new WebSecurityAdapter();

            _testHelper = new WebPermissionProviderTestHelper();
            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterMultiple <IWebSecurityAdapter>();
            serviceLocator.RegisterMultiple <IWxeSecurityAdapter> (() => _testHelper.WxeSecurityAdapter);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 8
0
        public void Setup()
        {
            _mocks = new MockRepository();
            _mockWebSecurityAdapter = _mocks.StrictMock <IWebSecurityAdapter> ();
            _mockSecurableObject    = _mocks.StrictMock <ISecurableObject> ();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterMultiple <IWebSecurityAdapter> (() => _mockWebSecurityAdapter);
            serviceLocator.RegisterMultiple <IWxeSecurityAdapter>();
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 9
0
        public void SetUp()
        {
            XmlNodeExtensions.Helper = new HtmlHelper();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle <IInfrastructureResourceUrlFactory> (() => new FakeInfrastructureResourceUrlFactory());
            serviceLocator.RegisterSingle <IScriptUtility> (() => new FakeScriptUtility());
            serviceLocator.RegisterSingle <IResourceUrlFactory> (() => new FakeResourceUrlFactory());

            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
        public virtual void SetUp()
        {
            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle <IErrorMessageGlobalizationService> (GetValidatorGlobalizationService);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);

            MemoryAppender = new MemoryAppender();
            BasicConfigurator.Configure(MemoryAppender);

            ValidationBuilder = serviceLocator.GetInstance <IValidatorBuilder>();
        }
Ejemplo n.º 11
0
        public void Setup()
        {
            _mocks = new MockRepository();
            _mockWebSecurityAdapter = _mocks.StrictMock <IWebSecurityAdapter> ();
            _mockNavigationCommand  = _mocks.StrictMock <NavigationCommand> ();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterMultiple <IWebSecurityAdapter> (() => _mockWebSecurityAdapter);
            serviceLocator.RegisterMultiple <IWxeSecurityAdapter>();
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
        public void SetUp()
        {
            _securityAdapter = new WebSecurityAdapter();

            _testHelper = new WebPermissionProviderTestHelper();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _testHelper.SecurityProvider);
            serviceLocator.RegisterSingle(() => _testHelper.PrincipalProvider);
            serviceLocator.RegisterSingle(() => _testHelper.FunctionalSecurityStrategy);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 13
0
        public void SetUp()
        {
            TestFunction      rootFunction   = new TestFunction();
            WxeContextFactory contextFactory = new WxeContextFactory();

            _wxeContext             = contextFactory.CreateContext(rootFunction);
            _mockRepository         = new MockRepository();
            _mockWxeSecurityAdapter = _mockRepository.StrictMock <IWxeSecurityAdapter> ();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterMultiple <IWxeSecurityAdapter> (() => _mockWxeSecurityAdapter);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 14
0
        public override void SetUp()
        {
            base.SetUp();

            _securityProviderStub  = MockRepository.GenerateStub <ISecurityProvider> ();
            _principalProviderStub = MockRepository.GenerateStub <IPrincipalProvider> ();
            _securityPrincipalStub = MockRepository.GenerateStub <ISecurityPrincipal> ();

            _principalProviderStub.Stub(stub => stub.GetPrincipal()).Return(_securityPrincipalStub);

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _securityProviderStub);
            serviceLocator.RegisterSingle(() => _principalProviderStub);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
        public void SetUp()
        {
            var stubSecurityProvider    = new StubSecurityProvider();
            var threadPrincipalProvider = new ThreadPrincipalProvider();
            var serviceLocator          = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle <ISecurityProvider> (() => stubSecurityProvider);
            serviceLocator.RegisterSingle <IPrincipalProvider> (() => threadPrincipalProvider);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);

            var clientTransaction = new SecurityClientTransactionFactory().CreateRootTransaction();

            clientTransaction.To <ClientTransaction>().EnterDiscardingScope();

            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);
        }
        public override void SetUp()
        {
            base.SetUp();

            var persistenceExtensionFactoryStub = MockRepository.GenerateStub <IPersistenceExtensionFactory>();

            _persistenceExtensionMock = MockRepository.GenerateMock <IPersistenceExtension>();

            persistenceExtensionFactoryStub
            .Stub(stub => stub.CreatePersistenceExtensions(TestableClientTransaction.ID))
            .Return(new[] { _persistenceExtensionMock });

            var locator = DefaultServiceLocator.Create();

            locator.RegisterSingle <IPersistenceExtensionFactory> (() => persistenceExtensionFactoryStub);
            _serviceLocatorScope = new ServiceLocatorScope(locator);
        }
        public void SetUp()
        {
            _stubSecurityProvider           = MockRepository.GenerateStub <ISecurityProvider>();
            _stubPrincipalProvider          = MockRepository.GenerateStub <IPrincipalProvider>();
            _stubPermissionProvider         = MockRepository.GenerateStub <IPermissionProvider>();
            _stubMemberResolver             = MockRepository.GenerateStub <IMemberResolver>();
            _stubFunctionalSecurityStrategy = MockRepository.GenerateStub <IFunctionalSecurityStrategy>();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _stubSecurityProvider);
            serviceLocator.RegisterSingle(() => _stubPrincipalProvider);
            serviceLocator.RegisterSingle(() => _stubPermissionProvider);
            serviceLocator.RegisterSingle(() => _stubMemberResolver);
            serviceLocator.RegisterSingle(() => _stubFunctionalSecurityStrategy);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 18
0
        public void SetUp()
        {
            _securityAdapter = new WxeSecurityAdapter();

            _mocks = new MockRepository();

            _mockSecurityProvider = _mocks.StrictMock <ISecurityProvider> ();
            SetupResult.For(_mockSecurityProvider.IsNull).Return(false);
            _mockPrincipalProvider          = _mocks.StrictMock <IPrincipalProvider> ();
            _mockFunctionalSecurityStrategy = _mocks.StrictMock <IFunctionalSecurityStrategy> ();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _mockSecurityProvider);
            serviceLocator.RegisterSingle(() => _mockPrincipalProvider);
            serviceLocator.RegisterSingle(() => _mockFunctionalSecurityStrategy);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 19
0
        public override void SetUp()
        {
            base.SetUp();

            var clientTransaction = ClientTransaction.CreateRootTransaction();
            var sampleObject      = LifetimeService.NewObject(clientTransaction, typeof(SampleObject), ParamList.Empty);

            _objectID = sampleObject.ID;
            clientTransaction.Commit();

            var locator = DefaultServiceLocator.Create();
            var factory = new LinqToSqlExtensionFactory();

            locator.RegisterSingle <IClientTransactionExtensionFactory> (() => factory);
            locator.RegisterSingle <IPersistenceExtensionFactory> (() => factory);
            _serviceLocatorScope = new ServiceLocatorScope(locator);

            _tracingLinqToSqlAppender = new TracingLinqToSqlAppender();
            SetAppender(_tracingLinqToSqlAppender);
        }
Ejemplo n.º 20
0
        public void SetUp()
        {
            var bindablePropertyReadAccessStrategy =
                new CompundBindablePropertyReadAccessStrategy(
                    new IBindablePropertyReadAccessStrategy[] { new BindableDomainObjectPropertyReadAccessStrategy() });

            var bindablePropertyWriteAccessStrategy =
                new CompundBindablePropertyWriteAccessStrategy(
                    new IBindablePropertyWriteAccessStrategy[] { new BindableDomainObjectPropertyWriteAccessStrategy() });

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle <IBindablePropertyReadAccessStrategy> (() => bindablePropertyReadAccessStrategy);
            serviceLocator.RegisterSingle <IBindablePropertyWriteAccessStrategy> (() => bindablePropertyWriteAccessStrategy);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);

            _disableAccessChecksBackup = SecurityConfiguration.Current.DisableAccessChecks;
            SecurityConfiguration.Current.DisableAccessChecks = true;
            ClientTransaction.CreateRootTransaction().EnterDiscardingScope();

            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);
        }
        public override void SetUp()
        {
            base.SetUp();

            _objectSecurityStrategyMock = MockRepository.GenerateStrictMock <IObjectSecurityStrategy>();

            _securableObject = new SecurableClassWithReferenceType <string> (_objectSecurityStrategyMock);

            _securityProviderStub = MockRepository.GenerateStub <ISecurityProvider>();

            _principalStub = MockRepository.GenerateStub <ISecurityPrincipal>();
            var principalProviderStub = MockRepository.GenerateStub <IPrincipalProvider>();

            principalProviderStub.Stub(_ => _.GetPrincipal()).Return(_principalStub);

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _securityProviderStub);
            serviceLocator.RegisterSingle(() => principalProviderStub);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);

            _strategy = new SecurityBasedBindablePropertyReadAccessStrategy();
        }
        public override void SetUp()
        {
            base.SetUp();

            BusinessObjectProvider.SetProvider(typeof(BindableDomainObjectProviderAttribute), null);

            _securityProviderStub  = MockRepository.GenerateStub <ISecurityProvider>();
            _principalProviderStub = MockRepository.GenerateStub <IPrincipalProvider>();
            _securityPrincipalStub = MockRepository.GenerateStub <ISecurityPrincipal>();

            _principalProviderStub.Stub(stub => stub.GetPrincipal()).Return(_securityPrincipalStub);

            _clientTransaction = ClientTransaction.CreateRootTransaction();
            _clientTransaction.Extensions.Add(new SecurityClientTransactionExtension());

            _clientTransaction.EnterNonDiscardingScope();

            var serviceLocator = DefaultServiceLocator.Create();

            serviceLocator.RegisterSingle(() => _securityProviderStub);
            serviceLocator.RegisterSingle(() => _principalProviderStub);
            _serviceLocatorScope = new ServiceLocatorScope(serviceLocator);
        }
Ejemplo n.º 23
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);
        }