public void SetReflectedClass_Twice()
        {
            BindableObjectClass bindableObjectClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(SimpleBusinessObjectClass));

            PropertyBase property = new StubPropertyBase(
                CreateParameters(
                    propertyInfo: GetPropertyInfo(typeof(SimpleBusinessObjectClass), "String"),
                    underlyingType: typeof(string),
                    concreteType: typeof(string),
                    listInfo: null,
                    isRequired: false,
                    isReadOnly: false));

            property.SetReflectedClass(bindableObjectClass);
            property.SetReflectedClass(BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(ClassWithIdentity)));
        }
        public void GetDisplayName_WithGlobalizationSerivce()
        {
            var mockMemberInformationGlobalizationService = _mockRepository.StrictMock <IMemberInformationGlobalizationService>();
            IPropertyInformation propertyInfo             = GetPropertyInfo(typeof(SimpleBusinessObjectClass), "String");
            PropertyBase         property = new StubPropertyBase(
                CreateParameters(
                    propertyInfo: propertyInfo,
                    underlyingType: typeof(string),
                    concreteType: typeof(string),
                    listInfo: null,
                    isRequired: false,
                    isReadOnly: false,
                    bindableObjectGlobalizationService: new BindableObjectGlobalizationService(
                        MockRepository.GenerateStub <IGlobalizationService>(),
                        mockMemberInformationGlobalizationService,
                        MockRepository.GenerateStub <IEnumerationGlobalizationService>(),
                        MockRepository.GenerateStub <IExtensibleEnumGlobalizationService>())));

            property.SetReflectedClass(_bindableObjectClass);

            Expect.Call(
                mockMemberInformationGlobalizationService.TryGetPropertyDisplayName(
                    Arg.Is(propertyInfo),
                    Arg <ITypeInformation> .Matches(c => c.ConvertToRuntimeType() == _bindableObjectClass.TargetType),
                    out Arg <string> .Out("MockString").Dummy))
            .Return(true);
            _mockRepository.ReplayAll();

            string actual = property.DisplayName;

            _mockRepository.VerifyAll();
            Assert.That(actual, Is.EqualTo("MockString"));
        }
        public void SetAndGetReflectedClass()
        {
            PropertyBase property = new StubPropertyBase(
                CreateParameters(
                    propertyInfo: GetPropertyInfo(typeof(SimpleBusinessObjectClass), "String"),
                    underlyingType: typeof(string),
                    concreteType: typeof(string),
                    listInfo: null,
                    isRequired: false,
                    isReadOnly: false));

            property.SetReflectedClass(_bindableObjectClass);

            Assert.That(property.ReflectedClass, Is.SameAs(_bindableObjectClass));
            Assert.That(((IBusinessObjectProperty)property).ReflectedClass, Is.SameAs(_bindableObjectClass));
        }
        public void SetReflectedClass_FromDifferentProviders()
        {
            var provider = new BindableObjectProvider();
            BindableObjectClass bindableObjectClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(SimpleBusinessObjectClass));

            PropertyBase property = new StubPropertyBase(
                CreateParameters(
                    businessObjectProvider: provider,
                    propertyInfo: GetPropertyInfo(typeof(SimpleBusinessObjectClass), "String"),
                    underlyingType: typeof(string),
                    concreteType: typeof(string),
                    listInfo: null,
                    isRequired: false,
                    isReadOnly: false));

            property.SetReflectedClass(bindableObjectClass);

            Assert.That(property.ReflectedClass, Is.SameAs(bindableObjectClass));
        }