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 })); }
public void AttributesOnClass() { ResourceManagerSet resourceManager = (ResourceManagerSet)MixedMultiLingualResources.GetResourceManager(typeof(ClassWithMultiLingualResourcesAttributes), false); Assert.That(resourceManager.ResourceManagers.Select(rm => rm.Name), Is.EqualTo(new[] { NamedResources.OnTarget })); }
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 })); }
public void AttributesFromMixin_InheritedFalse() { using (MixinConfiguration.BuildNew() .ForClass <ClassWithoutMultiLingualResourcesAttributes> ().AddMixin <MixinAddingMultiLingualResourcesAttributes1> ().EnterScope()) { Assert.That(MixedMultiLingualResources.ExistsResource(typeof(ClassWithoutMultiLingualResourcesAttributes)), Is.True); } }
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 })); } }
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 })); } }
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 })); } }
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 })); } }
public void AttributesOnBaseAndClass() { Assert.That(MixedMultiLingualResources.ExistsResource(typeof(InheritedClassWithMultiLingualResourcesAttributes)), Is.True); }
public void NoAttribute() { Assert.That(MixedMultiLingualResources.ExistsResource(typeof(ClassWithoutMultiLingualResourcesAttributes)), Is.False); }
public void NoAttributes_Inheritance() { MixedMultiLingualResources.GetResourceManager(typeof(ClassWithoutMultiLingualResourcesAttributes), true); }