Ejemplo n.º 1
0
        public void RemoveAffectedMixins_KeepsReplacingMixin()
        {
            var rule       = new MixinTreeReplacementSuppressionRule(typeof(DerivedNullMixin), typeof(NullMixin));
            var dictionary = CreateContextDictionary(typeof(DerivedNullMixin));

            rule.RemoveAffectedMixins(dictionary);

            Assert.That(dictionary.Keys, Is.EquivalentTo(new[] { typeof(DerivedNullMixin) }));
        }
Ejemplo n.º 2
0
        public void RemoveAffectedMixins_RemovesDerivedGenericTypeSpecialization()
        {
            var rule       = new MixinTreeReplacementSuppressionRule(typeof(NullMixin), typeof(GenericMixinWithVirtualMethod <>));
            var dictionary = CreateContextDictionary(typeof(DerivedGenericMixin <string>), typeof(double));

            rule.RemoveAffectedMixins(dictionary);

            Assert.That(dictionary.Keys, Is.EquivalentTo(new[] { typeof(double) }));
        }
Ejemplo n.º 3
0
        public void RemoveAffectedMixins_RemovesDerivedType()
        {
            var rule       = new MixinTreeReplacementSuppressionRule(typeof(NullMixin), typeof(object));
            var dictionary = CreateContextDictionary(typeof(string), typeof(double));

            rule.RemoveAffectedMixins(dictionary);

            Assert.That(dictionary.Keys, Is.Empty);
        }
Ejemplo n.º 4
0
        public void RemoveAffectedMixins_KeepsBaseType()
        {
            var rule       = new MixinTreeReplacementSuppressionRule(typeof(NullMixin), typeof(string));
            var dictionary = CreateContextDictionary(typeof(object), typeof(double));

            rule.RemoveAffectedMixins(dictionary);

            Assert.That(dictionary.Keys, Is.EquivalentTo(new[] { typeof(object), typeof(double) }));
        }
Ejemplo n.º 5
0
        public void RemoveAffectedMixins_KeepsGenericVariantsOfReplacingMixin()
        {
            var rule       = new MixinTreeReplacementSuppressionRule(typeof(GenericMixinWithVirtualMethod <>), typeof(object));
            var dictionary = CreateContextDictionary(typeof(GenericMixinWithVirtualMethod <object>), typeof(DerivedGenericMixin <object>));

            rule.RemoveAffectedMixins(dictionary);

            Assert.That(dictionary.Keys, Is.EquivalentTo(new[] {
                typeof(GenericMixinWithVirtualMethod <object>),
                typeof(DerivedGenericMixin <object>)
            }));
        }