public void IsBindableObjectImplementation_TrueWithClosedGenericType()
        {
            var mixinTargetType    = typeof(ManualBusinessObject);
            var businessObjectType = typeof(GenericBindableObject <string>);

            Assertion.IsTrue(mixinTargetType.IsAssignableFrom(businessObjectType));

            Assert.That(BindableObjectProvider.IsBindableObjectImplementation(businessObjectType), Is.True);
        }
Ejemplo n.º 2
0
        private Lazy <IBusinessObjectClass> GetReferenceClass()
        {
            return(new Lazy <IBusinessObjectClass> (
                       () =>
            {
                if (BindableObjectProvider.IsBindableObjectImplementation(UnderlyingType))
                {
                    var provider = BindableObjectProvider.GetProviderForBindableObjectType(UnderlyingType);
                    return provider.GetBindableObjectClass(UnderlyingType);
                }

                return GetReferenceClassFromService();
            },
                       LazyThreadSafetyMode.ExecutionAndPublication));
        }
        public List <Type> GetTypes(bool includeGac)
        {
            ICollection        types = GetAllDesignerTypes(includeGac);
            MixinConfiguration applicationContext = GetMixinConfiguration(types);

            List <Type> bindableTypes = new List <Type>();

            using (applicationContext.EnterScope())
            {
                foreach (Type type in types)
                {
                    if (!MixinTypeUtility.IsGeneratedByMixinEngine(type) && BindableObjectProvider.IsBindableObjectImplementation(type))
                    {
                        bindableTypes.Add(type);
                    }
                }
            }
            return(bindableTypes);
        }
        public void IsBindableObjectImplementation_TrueWithSealedTypeHavingAMixin()
        {
            var mixinTargetType    = typeof(ManualBusinessObject);
            var businessObjectType = typeof(SealedBindableObject);

            Assertion.IsTrue(mixinTargetType.IsAssignableFrom(businessObjectType));

            using (MixinConfiguration.BuildNew()
                   .AddMixinToClass(
                       MixinKind.Extending,
                       mixinTargetType,
                       typeof(MixinStub),
                       MemberVisibility.Public,
                       Enumerable.Empty <Type>(),
                       Enumerable.Empty <Type>())
                   .EnterScope())
            {
                Assert.That(BindableObjectProvider.IsBindableObjectImplementation(businessObjectType), Is.True);
            }
        }
 public void IsBindableObjectImplementation_TrueWithValueType()
 {
     Assert.That(BindableObjectProvider.IsBindableObjectImplementation(typeof(ValueTypeBindableObject)), Is.True);
 }
 public void IsBindableObjectImplementation_False()
 {
     Assert.That(BindableObjectProvider.IsBindableObjectImplementation(typeof(object)), Is.False);
     Assert.That(BindableObjectProvider.IsBindableObjectImplementation(typeof(ManualBusinessObject)), Is.False);
 }
 public void IsBindableObjectImplementation_TrueWithBase()
 {
     Assert.That(BindableObjectProvider.IsBindableObjectImplementation(typeof(ClassDerivedFromBindableObjectBase)), Is.True);
 }
 public void IsBindableObjectImplementation_TrueWithMixin_ConcreteType()
 {
     Assert.That(BindableObjectProvider.IsBindableObjectImplementation(TypeFactory.GetConcreteType(typeof(SimpleBusinessObjectClass))), Is.True);
 }
 public void IsBindableObjectImplementation_TrueWithMixin_TargetType()
 {
     Assert.That(BindableObjectProvider.IsBindableObjectImplementation(typeof(SimpleBusinessObjectClass)), Is.True);
 }