Esempio n. 1
0
        public void ComposedInterfacesAndDependenciesForBase()
        {
            TargetClassDefinition bt3 =
                DefinitionObjectMother.BuildUnvalidatedDefinition(typeof(BaseType3), typeof(BT3Mixin4), typeof(BT3Mixin7Base));

            MixinDefinition m4 = bt3.Mixins[typeof(BT3Mixin4)];
            MixinDefinition m7 = bt3.Mixins[typeof(BT3Mixin7Base)];

            NextCallDependencyDefinition d2 = m7.NextCallDependencies[typeof(ICBaseType3BT3Mixin4)];

            Assert.That(d2.GetImplementer(), Is.Null);

            Assert.That(d2.IsAggregate, Is.True);

            Assert.That(d2.AggregatedDependencies[typeof(ICBaseType3)].IsAggregate, Is.True);
            Assert.That(d2.AggregatedDependencies[typeof(ICBaseType3)].Parent, Is.SameAs(d2));

            Assert.That(d2.AggregatedDependencies[typeof(ICBaseType3)]
                        .AggregatedDependencies[typeof(IBaseType31)].IsAggregate, Is.False);
            Assert.That(d2.AggregatedDependencies[typeof(ICBaseType3)]
                        .AggregatedDependencies[typeof(IBaseType31)].GetImplementer(), Is.SameAs(bt3));

            Assert.That(d2.AggregatedDependencies[typeof(IBT3Mixin4)].IsAggregate, Is.False);
            Assert.That(d2.AggregatedDependencies[typeof(IBT3Mixin4)].GetImplementer(), Is.SameAs(m4));

            Assert.That(d2.AggregatedDependencies[typeof(IBT3Mixin4)].Aggregator, Is.SameAs(d2));

            Assert.That(bt3.RequiredNextCallTypes[typeof(ICBaseType3)].IsEmptyInterface, Is.True);
            Assert.That(bt3.RequiredNextCallTypes[typeof(ICBaseType3)].IsAggregatorInterface, Is.True);

            Assert.That(bt3.RequiredNextCallTypes.ContainsKey(typeof(ICBaseType3BT3Mixin4)), Is.True);
            Assert.That(bt3.RequiredNextCallTypes.ContainsKey(typeof(ICBaseType3)), Is.True);
            Assert.That(bt3.RequiredNextCallTypes.ContainsKey(typeof(IBaseType31)), Is.True);
            Assert.That(bt3.RequiredNextCallTypes.ContainsKey(typeof(IBT3Mixin4)), Is.True);
        }
Esempio n. 2
0
 public void EmptyInterface()
 {
     using (MixinConfiguration.BuildFromActive().ForClass <BaseType1> ().Clear().AddMixins(typeof(MixinWithEmptyInterface), typeof(MixinRequiringEmptyInterface)).EnterScope())
     {
         TargetClassDefinition          bt1         = DefinitionObjectMother.GetActiveTargetClassDefinition(typeof(BaseType1));
         MixinDefinition                m1          = bt1.Mixins[typeof(MixinWithEmptyInterface)];
         MixinDefinition                m2          = bt1.Mixins[typeof(MixinRequiringEmptyInterface)];
         NextCallDependencyDefinition   dependency  = m2.NextCallDependencies[0];
         RequiredNextCallTypeDefinition requirement = dependency.RequiredType;
         Assert.That(requirement.IsEmptyInterface, Is.True);
         Assert.That(requirement.IsAggregatorInterface, Is.False);
         Assert.That(dependency.GetImplementer(), Is.SameAs(m1));
     }
 }