public void GetClosedMixinType_BindToTargetType()
        {
            var  instantiator = new MixinTypeCloser(typeof(BaseType3));
            Type t            = instantiator.GetClosedMixinType(typeof(BT3Mixin3 <,>));

            Assert.That(t, Is.EqualTo(typeof(BT3Mixin3 <BaseType3, IBaseType33>)));
        }
        public void GetClosedMixinType_BindToTargetParameter()
        {
            var  instantiator = new MixinTypeCloser(typeof(GenericTargetClass <string>));
            Type t            = instantiator.GetClosedMixinType(typeof(GenericMixin <>));

            Assert.That(t, Is.EqualTo(typeof(GenericMixin <string>)));
        }
        public void GetClosedMixinType_NonGenericMixin()
        {
            var  instantiator = new MixinTypeCloser(typeof(BaseType3));
            Type t            = instantiator.GetClosedMixinType(typeof(object));

            Assert.That(t, Is.EqualTo(typeof(object)));
        }
        public void GetClosedMixinType_BindToConstraints()
        {
            var  instantiator = new MixinTypeCloser(typeof(BaseType3));
            Type t            = instantiator.GetClosedMixinType(typeof(BT3Mixin6 <,>));

            Assert.That(t, Is.EqualTo(typeof(BT3Mixin6 <IBT3Mixin6TargetCallDependencies, IBT3Mixin6NextCallDependencies>)));
        }
Пример #5
0
        public TargetClassDefinition(ClassContext configurationContext)
            : base(configurationContext.Type)
        {
            ArgumentUtility.CheckNotNull("configurationContext", configurationContext);

            _receivedAttributes = new MultiDefinitionCollection <Type, AttributeIntroductionDefinition> (a => a.AttributeType);

            _configurationContext = configurationContext;
            _mixinTypeCloser      = new MixinTypeCloser(configurationContext.Type);
        }
        public void GetClosedMixinType_PositionalAndTargetBound()
        {
            var instantiator = new MixinTypeCloser(typeof(GenericTargetClass <string>));

            instantiator.GetClosedMixinType(typeof(GenericMixinWithPositionalAndTargetBoundParameter <>));
        }
        public void GetClosedMixinType_UnmappablePosition()
        {
            var instantiator = new MixinTypeCloser(typeof(BaseType1));

            instantiator.GetClosedMixinType(typeof(GenericMixin <>));
        }
        public void GetClosedMixinType_BindToTargetAndConstraints()
        {
            var instantiator = new MixinTypeCloser(typeof(BaseType1));

            instantiator.GetClosedMixinType(typeof(GenericMixinWithDoubleBindingInformation <>));
        }
        public void GetClosedMixinType_BindToInvalidTargetType()
        {
            var instantiator = new MixinTypeCloser(typeof(BaseType1));

            instantiator.GetClosedMixinType(typeof(BT3Mixin3 <,>));
        }
        public void GetClosedMixinType_MixinWithoutBindingInformationThrows()
        {
            var instantiator = new MixinTypeCloser(typeof(BaseType3));

            instantiator.GetClosedMixinType(typeof(GenericMixinWithoutBindingInformation <>));
        }
        public void GetClosedMixinType_MixinWithUnsatisfiableConstraintsThrows()
        {
            var instantiator = new MixinTypeCloser(typeof(BaseType3));

            instantiator.GetClosedMixinType(typeof(GenericMixinWithUnsatisfiableConstraints <>));
        }
Пример #12
0
        public MixinDefinition GetMixinByConfiguredType(Type configuredType)
        {
            Type realType = MixinTypeCloser.GetClosedMixinType(configuredType);

            return(_mixins[realType]);
        }
Пример #13
0
        public bool HasMixinWithConfiguredType(Type configuredType)
        {
            Type realType = MixinTypeCloser.GetClosedMixinType(configuredType);

            return(_mixins.ContainsKey(realType));
        }