public void CanRead_WithoutStrategies_ReturnsTrue()
        {
            var strategy = new CompundBindablePropertyReadAccessStrategy(Enumerable.Empty <IBindablePropertyReadAccessStrategy>());
            var result   = strategy.CanRead(_businessObject, _property);

            Assert.That(result, Is.True);
        }
        public override void SetUp()
        {
            base.SetUp();
            _mockRepository = new MockRepository();

            _innerStrategy1 = _mockRepository.StrictMock <IBindablePropertyReadAccessStrategy>();
            _innerStrategy2 = _mockRepository.StrictMock <IBindablePropertyReadAccessStrategy>();
            _innerStrategy3 = _mockRepository.StrictMock <IBindablePropertyReadAccessStrategy>();

            _strategy = new CompundBindablePropertyReadAccessStrategy(new[] { _innerStrategy1, _innerStrategy2, _innerStrategy3 });

            _businessObjectProvider = CreateBindableObjectProviderWithStubBusinessObjectServiceFactory();
            _property       = new StubPropertyBase(GetPropertyParameters(GetPropertyInfo(typeof(ClassWithAllDataTypes), "Byte"), _businessObjectProvider));
            _businessObject = MockRepository.GenerateStub <IBusinessObject>();
        }
示例#3
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);
        }