public void Migrate_LanguageNameIsNotSet_LanguageNameIsSetToWhatIanaSubtagRegistrySays()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version0WithLanguageSubtagAndName("en", String.Empty));
				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				var repo = new TestLdmlInFolderWritingSystemRepository(environment.LdmlPath);
				migrator.ResetRemovedProperties(repo);

				WritingSystemDefinition ws = repo.Get("en");
				Assert.That(ws.Language.Name, Is.EqualTo("English"));
			}
		}
		public void Migrate_OriginalFileContainsPalaso2Namespace_InfoIsMigrated()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile("test.ldml", LdmlContentForTests.Version2("qaa", "", "", "x-kal"));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				var repo = new TestLdmlInFolderWritingSystemRepository(environment.LdmlPath);
				migrator.ResetRemovedProperties(repo);

				WritingSystemDefinition ws = repo.Get("qaa-x-kal");
				Assert.That(ws.DefaultFontSize, Is.EqualTo(12));
				Assert.That(ws.DefaultFont.Name, Is.EqualTo("Arial"));
				Assert.That(ws.KnownKeyboards.Select(kd => kd.Id), Is.EqualTo(new[] {"en-US_English"}));
			}
		}
		public void Migrate_OriginalFileContainsPalasoNamespace_InfoIsMigrated()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile(
					"test.ldml",
					LdmlContentForTests.Version0WithAllSortsOfDatathatdoesNotNeedSpecialAttention("x-kal", "", "", ""));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				var repo = new TestLdmlInFolderWritingSystemRepository(environment.LdmlPath);
				migrator.ResetRemovedProperties(repo);

				WritingSystemDefinition ws = repo.Get("qaa-x-kal");
				Assert.That(ws.SpellCheckingId, Is.EqualTo("ol"));
				Assert.That(ws.Abbreviation, Is.EqualTo("la"));
				Assert.That(ws.DefaultFontSize, Is.EqualTo(12));
				Assert.That(ws.Language.Name, Is.EqualTo("language"));
				Assert.That(ws.DefaultFont.Name, Is.EqualTo("Arial"));
				Assert.That(ws.Keyboard, Is.EqualTo("bogusKeyboard"));
			}
		}
		public void Migrate_OriginalFileContainsFwNamespaceWithOldValidChars_ValidCharsIsMigratedFromLegacyOverridesFile()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile(
					"test.ldml",
					LdmlContentForTests.Version0WithOldFwValidChars("en", "", "US", ""));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				var repo = new TestLdmlInFolderWritingSystemRepository(environment.LdmlPath);
				migrator.ResetRemovedProperties(repo);

				var main = new CharacterSetDefinition("main") {Characters = {"x", "y", "z"}};

				WritingSystemDefinition ws = repo.Get("en-US");

				Assert.That(ws.CharacterSets["main"].ValueEquals(main));
				Assert.That(ws.CharacterSets.Contains("numeric"), Is.False);
				Assert.That(ws.CharacterSets.Contains("punctuation"), Is.False);
			}
		}
		public void Migrate_OriginalFileContainsFwNamespace_InfoIsMigrated()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile(
					"test.ldml",
					LdmlContentForTests.Version0WithFw("en", "x-Kala", "x-AP", "1996-x-myOwnVariant"));

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();

				var repo = new TestLdmlInFolderWritingSystemRepository(environment.LdmlPath);
				migrator.ResetRemovedProperties(repo);

				var other = new FontDefinition("Arial") {Features = "order=3 children=2 color=red createDate=1996", Roles = FontRoles.Default};

				var main = new CharacterSetDefinition("main")
				{
					Characters = {
						"α", "Α", "ά", "ὰ", "ᾷ", "ἀ", "Ἀ", "ἁ", "Ἁ", "ἄ", "Ἄ", "ἂ", "ἅ", "Ἅ", "ἃ", "Ἃ", "ᾶ", "ᾳ", "ᾴ", "ἆ", "Ἆ", "ᾄ", "ᾅ", "β", "Β", "γ",
						"Γ", "δ", "Δ", "ε", "Ε", "έ", "ὲ", "ἐ", "Ἐ", "ἑ", "Ἑ", "ἔ", "Ἔ", "ἕ", "Ἕ", "ἓ", "Ἓ", "ζ", "Ζ", "η", "Η", "ή", "ὴ", "ῇ", "ἠ", "Ἠ",
						"ἡ", "Ἡ", "ἤ", "Ἤ", "ἢ", "ἥ", "Ἥ", "Ἢ", "ἣ", "ᾗ", "ῆ", "ῃ", "ῄ", "ἦ", "Ἦ", "ᾖ", "ἧ", "ᾐ", "ᾑ", "ᾔ", "θ", "Θ", "ι", "ί", "ὶ", "ϊ",
						"ΐ", "ῒ", "ἰ", "Ἰ", "ἱ", "Ἱ", "ἴ", "Ἴ", "ἵ", "Ἵ", "ἳ", "ῖ", "ἶ", "ἷ", "κ", "Κ", "λ", "Λ", "μ", "Μ", "ν", "Ν", "ξ", "Ξ", "ο", "Ο",
						"ό", "ὸ", "ὀ", "Ὀ", "ὁ", "Ὁ", "ὄ", "Ὄ", "ὅ", "ὂ", "Ὅ", "ὃ", "Ὃ", "π", "Π", "ρ", "Ρ", "ῥ", "Ῥ", "σ", "ς", "Σ", "τ", "Τ", "υ", "Υ",
						"ύ", "ὺ", "ϋ", "ΰ", "ῢ", "ὐ", "ὑ", "Ὑ", "ὔ", "ὕ", "ὒ", "Ὕ", "ὓ", "ῦ", "ὖ", "ὗ", "Ὗ", "φ", "Φ", "χ", "Χ", "ψ", "Ψ", "ω", "ώ", "ὼ",
						"ῷ", "ὠ", "ὡ", "Ὡ", "ὤ", "Ὤ", "ὢ", "ὥ", "Ὥ", "ᾧ", "ῶ", "ῳ", "ῴ", "ὦ", "Ὦ", "ὧ", "Ὧ", "ᾠ"
					}
				};

				var numeric = new CharacterSetDefinition("numeric") {Characters = {"๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙"}};

				var punctuation = new CharacterSetDefinition("punctuation") {Characters = {" ", "-", ",", ".", "’", "«", "»", "(", ")", "[", "]"}};

				WritingSystemDefinition ws = repo.Get("en-Qaaa-QM-1996-x-Kala-AP-myOwnVar");

				Assert.That(ws.DefaultFont.ValueEquals(other));
				Assert.That(ws.WindowsLcid, Is.EqualTo("4321"));
				Assert.That(ws.CharacterSets["main"].ValueEquals(main));
				Assert.That(ws.CharacterSets["numeric"].ValueEquals(numeric));
				Assert.That(ws.CharacterSets["punctuation"].ValueEquals(punctuation));

				// ScriptName, RegionName, VariantName, LegacyMapping, IsGraphiteEnabled
				Assert.That(ws.LegacyMapping, Is.EqualTo("SomeMapper"));
				Assert.That(ws.IsGraphiteEnabled, Is.True);
				Assert.That(ws.Script.Name, Is.EqualTo("scriptName"));
				Assert.That(ws.Region.Name, Is.EqualTo("regionName"));
				Assert.That(ws.Variants[1].Name, Is.EqualTo("aVarName"));
			}
		}
		public void Migrate_OriginalFileContainsSystemCollationInfo_CollationInfoIsMigrated()
		{
			using (var environment = new TestEnvironment())
			{
				environment.WriteLdmlFile(
					"test.ldml",
					LdmlContentForTests.Version0WithSystemCollationInfo());
				var wsV0 = new WritingSystemDefinitionV0();
				new LdmlAdaptorV0().Read(environment.FilePath("test.ldml"), wsV0);

				var migrator = new LdmlInFolderWritingSystemRepositoryMigrator(environment.LdmlPath, environment.OnMigrateCallback);
				migrator.Migrate();
				var repo = new TestLdmlInFolderWritingSystemRepository(environment.LdmlPath);
				migrator.ResetRemovedProperties(repo);

				WritingSystemDefinition ws = repo.Get("de");
				var scd = new SystemCollationDefinition {LanguageTag = "de"};
				Assert.That(ws.DefaultCollation.ValueEquals(scd), Is.True);
			}
		}