public void GetMixinArray_WithTwoFittingSupplied()
        {
            var mixin1 = new NullMixin();
            MixinArrayInitializer initializer = CreateInitializer(typeof(NullTarget), typeof(NullMixin));

            initializer.CreateMixinArray(new object[] { mixin1, mixin1 });
        }
        public void GetMixinArray_WithFittingSuppliedForDerivedMixin()
        {
            var mixin1                        = new MixinWithVirtualMethod();
            var concreteMixinType             = CodeGenerationTypeMother.GetGeneratedMixinType(typeof(ClassOverridingSpecificMixinMember), typeof(MixinWithVirtualMethod));
            MixinArrayInitializer initializer = CreateInitializer(typeof(ClassOverridingSpecificMixinMember), concreteMixinType);

            initializer.CreateMixinArray(new object[] { mixin1 });
        }
        public void GetMixinArray_ForOrdinaryMixin()
        {
            MixinArrayInitializer initializer = CreateInitializer(typeof(NullTarget), typeof(NullMixin));

            var mixinArray = initializer.CreateMixinArray(null);

            Assert.That(mixinArray.Length, Is.EqualTo(1));
            Assert.That(mixinArray[0], Is.InstanceOf(typeof(NullMixin)));
        }
        public void GetMixinArray_ForValueTypeMixin()
        {
            MixinArrayInitializer initializer = CreateInitializer(typeof(BaseType1), typeof(ValueTypeMixin));

            var mixinArray = initializer.CreateMixinArray(null);

            Assert.That(mixinArray.Length, Is.EqualTo(1));
            Assert.That(mixinArray[0], Is.InstanceOf(typeof(ValueTypeMixin)));
        }
        public void GetMixinArray_WithSuppliedAssignableMixin()
        {
            var mixin1 = new DerivedNullMixin();
            MixinArrayInitializer initializer = CreateInitializer(typeof(NullTarget), typeof(NullMixin));

            var mixinArray = initializer.CreateMixinArray(new object[] { mixin1 });

            Assert.That(mixinArray.Length, Is.EqualTo(1));
            Assert.That(mixinArray[0], Is.SameAs(mixin1));
        }
        public void GetMixinArray_ForDerivedMixin()
        {
            Type concreteMixinType            = CodeGenerationTypeMother.GetGeneratedMixinType(typeof(ClassOverridingMixinMembers), typeof(MixinWithAbstractMembers));
            MixinArrayInitializer initializer = CreateInitializer(typeof(ClassOverridingMixinMembers), concreteMixinType);

            var mixinArray = initializer.CreateMixinArray(null);

            Assert.That(mixinArray.Length, Is.EqualTo(1));
            Assert.That(mixinArray[0], Is.InstanceOf(typeof(MixinWithAbstractMembers)));
            Assert.That(mixinArray[0].GetType(), Is.Not.SameAs(typeof(MixinWithAbstractMembers)));
        }
        public void GetMixinArray_WithSuppliedMixins()
        {
            var mixin1 = new NullMixin();
            var mixin3 = new NullMixin3();

            MixinArrayInitializer initializer = CreateInitializer(typeof(NullTarget), typeof(NullMixin), typeof(NullMixin2), typeof(NullMixin3));

            var mixinArray = initializer.CreateMixinArray(new object[] { mixin1, mixin3 });

            Assert.That(mixinArray.Length, Is.EqualTo(3));
            Assert.That(mixinArray[0], Is.SameAs(mixin1));
            Assert.That(mixinArray[1], Is.InstanceOf(typeof(NullMixin2)));
            Assert.That(mixinArray[2], Is.SameAs(mixin3));
        }
        public void GetMixinArray_MixinCtorNotFound()
        {
            MixinArrayInitializer initializer = CreateInitializer(typeof(NullTarget), typeof(MixinArrayInitializer));

            initializer.CreateMixinArray(null);
        }