public void Import_LocalizedNamesTwice() { string cultureXml = @" <localizedNames xmlns=""http://www.re-motion.org/Security/Metadata/Localization/1.0"" culture=""de""> <localizedName ref=""b8621bc9-9ab3-4524-b1e4-582657d6b420"" comment=""Clerk|Remotion.Security.UnitTests.TestDomain.DomainAbstractRoles, Remotion.Security.UnitTests.TestDomain""> Beamte </localizedName> <localizedName ref=""93969f13-65d7-49f4-a456-a1686a4de3de"" comment=""Confidentiality""> Vertraulichkeit </localizedName> </localizedNames> "; ObjectID clerkNameID; ObjectID confidentialityNameID; _importer.Import(GetXmlDocument(cultureXml)); using (_transaction.EnterNonDiscardingScope()) { clerkNameID = _importer.LocalizedNames[0].ID; confidentialityNameID = _importer.LocalizedNames[1].ID; } _importer = new CultureImporter(_transaction); cultureXml = @" <localizedNames xmlns=""http://www.re-motion.org/Security/Metadata/Localization/1.0"" culture=""de""> <localizedName ref=""b8621bc9-9ab3-4524-b1e4-582657d6b420"" comment=""Clerk|Remotion.Security.UnitTests.TestDomain.DomainAbstractRoles, Remotion.Security.UnitTests.TestDomain""> Beamter </localizedName> <localizedName ref=""93969f13-65d7-49f4-a456-a1686a4de3de"" comment=""Confidentiality""> Vertraulichkeit </localizedName> <localizedName ref=""93969f13-65d7-49f4-a456-a1686a4de3de|0"" comment=""Confidentiality|Public""> Öffentlich </localizedName> </localizedNames> "; _importer.Import(GetXmlDocument(cultureXml)); using (_transaction.EnterNonDiscardingScope()) { Assert.AreEqual(3, _importer.LocalizedNames.Count, "LocalizedNames count"); Assert.That(_importer.LocalizedNames[0].Text, Is.EqualTo("Beamter")); Assert.That(_importer.LocalizedNames[0].ID, Is.EqualTo(clerkNameID)); Assert.That(_importer.LocalizedNames[0].MetadataObject.MetadataItemID, Is.EqualTo(new Guid("b8621bc9-9ab3-4524-b1e4-582657d6b420"))); Assert.That(_importer.LocalizedNames[1].Text, Is.EqualTo("Vertraulichkeit")); Assert.That(_importer.LocalizedNames[1].ID, Is.EqualTo(confidentialityNameID)); Assert.That(_importer.LocalizedNames[1].MetadataObject.MetadataItemID, Is.EqualTo(new Guid("93969f13-65d7-49f4-a456-a1686a4de3de"))); Assert.That(_importer.LocalizedNames[2].Text, Is.EqualTo("Öffentlich")); } }
private void ImportLocalization(ClientTransaction transaction) { CultureImporter importer = new CultureImporter(transaction); LocalizationFileNameStrategy localizationFileNameStrategy = new LocalizationFileNameStrategy(); string[] localizationFileNames = localizationFileNameStrategy.GetLocalizationFileNames(_arguments.MetadataFile); foreach (string localizationFileName in localizationFileNames) { WriteInfo("Importing localization file '{0}'.", localizationFileName); importer.Import(localizationFileName); } if (localizationFileNames.Length == 0) { WriteInfo("Localization files not found."); } }
public void Import_EmptyCultureFile() { string cultureXml = @" <localizedNames xmlns=""http://www.re-motion.org/Security/Metadata/Localization/1.0"" culture=""de"" /> "; _importer.Import(GetXmlDocument(cultureXml)); using (_transaction.EnterNonDiscardingScope()) { Assert.AreEqual(0, _importer.LocalizedNames.Count, "LocalizedNames count"); Assert.IsNotNull(_importer.Cultures, "Cultures"); Assert.That(_importer.Cultures.Count, Is.EqualTo(1)); Assert.That(_importer.Cultures[0].CultureName, Is.EqualTo("de")); } }