예제 #1
0
        public void AttributesOnBaseAndClass_InheritedTrue()
        {
            ResourceManagerSet resourceManager =
                (ResourceManagerSet)MixedMultiLingualResources.GetResourceManager(typeof(InheritedClassWithMultiLingualResourcesAttributes), true);

            Assert.That(resourceManager.ResourceManagers.Select(rm => rm.Name), Is.EqualTo(new[] { NamedResources.OnInherited, NamedResources.OnTarget }));
        }
예제 #2
0
        public void AttributesOnClass()
        {
            ResourceManagerSet resourceManager =
                (ResourceManagerSet)MixedMultiLingualResources.GetResourceManager(typeof(ClassWithMultiLingualResourcesAttributes), false);

            Assert.That(resourceManager.ResourceManagers.Select(rm => rm.Name), Is.EqualTo(new[] { NamedResources.OnTarget }));
        }
예제 #3
0
        public void AttributesOnBase_DoesNotThrowResourceExceptionBecauseOfBug()
        {
            ResourceManagerSet resourceManager =
                (ResourceManagerSet)MixedMultiLingualResources.GetResourceManager(typeof(InheritedClassWithoutMultiLingualResourcesAttributes), false);

            Assert.That(resourceManager.ResourceManagers.Select(rm => rm.Name), Is.EqualTo(new[] { NamedResources.OnInherited }));
        }
예제 #4
0
 public void AttributesFromMixin_InheritedFalse()
 {
     using (MixinConfiguration.BuildNew()
            .ForClass <ClassWithoutMultiLingualResourcesAttributes> ().AddMixin <MixinAddingMultiLingualResourcesAttributes1> ().EnterScope())
     {
         Assert.That(MixedMultiLingualResources.ExistsResource(typeof(ClassWithoutMultiLingualResourcesAttributes)), Is.True);
     }
 }
예제 #5
0
        public void AttributesFromMixin_InheritedTrue()
        {
            using (MixinConfiguration.BuildNew()
                   .ForClass <ClassWithoutMultiLingualResourcesAttributes>()
                   .AddMixin <MixinAddingMultiLingualResourcesAttributes1>()
                   .EnterScope())
            {
                ResourceManagerSet resourceManager =
                    (ResourceManagerSet)MixedMultiLingualResources.GetResourceManager(typeof(ClassWithoutMultiLingualResourcesAttributes), true);

                Assert.That(resourceManager.ResourceManagers.Select(rm => rm.Name), Is.EqualTo(new[] { NamedResources.OnMixin1 }));
            }
        }
예제 #6
0
        public void AttributesFromMultipleMixins_InheritedFalse()
        {
            using (MixinConfiguration.BuildNew()
                   .ForClass <ClassWithoutMultiLingualResourcesAttributes>()
                   .AddMixin <MixinAddingMultiLingualResourcesAttributes1>()
                   .AddMixin <MixinAddingMultiLingualResourcesAttributes2>()
                   .EnterScope())
            {
                ResourceManagerSet resourceManager =
                    (ResourceManagerSet)MixedMultiLingualResources.GetResourceManager(typeof(ClassWithoutMultiLingualResourcesAttributes), false);

                Assert.That(resourceManager.ResourceManagers.Select(rm => rm.Name), Is.EquivalentTo(new[] { NamedResources.OnMixin1, NamedResources.OnMixin2a, NamedResources.OnMixin2b }));
                Assert.That(resourceManager.ResourceManagers.Take(1).Select(rm => rm.Name), Is.EqualTo(new[] { NamedResources.OnMixin1 }));
                Assert.That(resourceManager.ResourceManagers.Skip(1).Select(rm => rm.Name), Is.EquivalentTo(new[] { NamedResources.OnMixin2a, NamedResources.OnMixin2b }));
            }
        }
예제 #7
0
        public void AttributesFromMixinsAndBaseAndClass_InheritedTrue()
        {
            using (MixinConfiguration.BuildNew()
                   .ForClass <InheritedClassWithMultiLingualResourcesAttributes>()
                   .AddMixin <MixinAddingMultiLingualResourcesAttributes1>()
                   .AddMixin <MixinAddingMultiLingualResourcesAttributes2>()
                   .EnterScope())
            {
                ResourceManagerSet resourceManager =
                    (ResourceManagerSet)MixedMultiLingualResources.GetResourceManager(typeof(InheritedClassWithMultiLingualResourcesAttributes), true);

                Assert.That(
                    resourceManager.ResourceManagers.Select(rm => rm.Name),
                    Is.EquivalentTo(new[] { NamedResources.OnInherited, NamedResources.OnMixin1, NamedResources.OnMixin2a, NamedResources.OnMixin2b, NamedResources.OnTarget }));
                Assert.That(resourceManager.ResourceManagers.Take(2).Select(rm => rm.Name), Is.EquivalentTo(new[] { NamedResources.OnInherited, NamedResources.OnMixin1 }));
                Assert.That(resourceManager.ResourceManagers.Skip(2).Take(2).Select(rm => rm.Name), Is.EquivalentTo(new[] { NamedResources.OnMixin2a, NamedResources.OnMixin2b }));
                Assert.That(resourceManager.ResourceManagers.Skip(4).Select(rm => rm.Name), Is.EquivalentTo(new[] { NamedResources.OnTarget }));
            }
        }
예제 #8
0
        public void AttributesFromMixinOfMixin_InheritedFalse()
        {
            using (MixinConfiguration.BuildNew()
                   .ForClass <ClassWithoutMultiLingualResourcesAttributes>()
                   .AddMixin <MixinAddingMultiLingualResourcesAttributes1>()
                   .AddMixin <MixinAddingMultiLingualResourcesAttributes2>()
                   .ForClass <MixinAddingMultiLingualResourcesAttributes1>()
                   .AddMixin <MixinOfMixinWithResources>()
                   .EnterScope())
            {
                ResourceManagerSet resourceManager =
                    (ResourceManagerSet)MixedMultiLingualResources.GetResourceManager(typeof(ClassWithoutMultiLingualResourcesAttributes), false);

                //Note: MixinOfMixin was previously sorted after the introducing mixin, but there is no know client code that actually used MixinOfMixin with resources.
                Assert.That(
                    resourceManager.ResourceManagers.Select(rm => rm.Name),
                    Is.EquivalentTo(new[] { NamedResources.MixinOfMixinWithResources, NamedResources.OnMixin1, NamedResources.OnMixin2a, NamedResources.OnMixin2b }));
                Assert.That(resourceManager.ResourceManagers.Take(2).Select(rm => rm.Name), Is.EqualTo(new[] { NamedResources.MixinOfMixinWithResources, NamedResources.OnMixin1 }));
                Assert.That(resourceManager.ResourceManagers.Skip(2).Select(rm => rm.Name), Is.EquivalentTo(new[] { NamedResources.OnMixin2a, NamedResources.OnMixin2b }));
            }
        }
예제 #9
0
 public void AttributesOnBaseAndClass()
 {
     Assert.That(MixedMultiLingualResources.ExistsResource(typeof(InheritedClassWithMultiLingualResourcesAttributes)), Is.True);
 }
예제 #10
0
 public void NoAttribute()
 {
     Assert.That(MixedMultiLingualResources.ExistsResource(typeof(ClassWithoutMultiLingualResourcesAttributes)), Is.False);
 }
예제 #11
0
 public void NoAttributes_Inheritance()
 {
     MixedMultiLingualResources.GetResourceManager(typeof(ClassWithoutMultiLingualResourcesAttributes), true);
 }