Пример #1
0
        public void Constructor_LdmlFolderStoreContainsMultipleFilesThatOnLoadDescribeWritingSystemsWithIdenticalRFC5646Tags_Throws()
        {
            using (var environment = new TestEnvironment())
            {
                File.WriteAllText(Path.Combine(environment.TestPath, "de-Zxxx-x-audio.ldml"),
                                  LdmlContentForTests.CurrentVersion("de", WellKnownSubTags.Audio.Script, "",
                                                                     WellKnownSubTags.Audio.PrivateUseSubtag));
                File.WriteAllText(Path.Combine(environment.TestPath, "inconsistent-filename.ldml"),
                                  LdmlContentForTests.CurrentVersion("de", WellKnownSubTags.Audio.Script, "",
                                                                     WellKnownSubTags.Audio.PrivateUseSubtag));

                var repository = new LdmlInFolderWritingSystemRepository(environment.TestPath);
                var problems   = repository.LoadProblems;

                Assert.That(problems.Count, Is.EqualTo(2));
                Assert.That(
                    problems[0].Exception,
                    Is.TypeOf <ApplicationException>().With.Property("Message").
                    ContainsSubstring(String.Format(
                                          @"The writing system file {0} seems to be named inconsistently. It contains the Rfc5646 tag: 'de-Zxxx-x-audio'. The name should have been made consistent with its content upon migration of the writing systems.",
                                          Path.Combine(environment.TestPath, "inconsistent-filename.ldml")
                                          ))
                    );
                Assert.That(
                    problems[1].Exception,
                    Is.TypeOf <ArgumentException>().With.Property("Message").
                    ContainsSubstring("Unable to set writing system 'de-Zxxx-x-audio' because this id already exists. Please change this writing system id before setting it.")
                    );
            }
        }
Пример #2
0
        public void Constructor_LdmlFolderStoreContainsInconsistentlyNamedFileDifferingInCaseOnly_HasNoProblem()
        {
            using (var environment = new TestEnvironment())
            {
                File.WriteAllText(Path.Combine(environment.TestPath, "tpi-latn.ldml"),
                                  LdmlContentForTests.CurrentVersion("tpi", "Latn", "", ""));

                var repository = new LdmlInFolderWritingSystemRepository(environment.TestPath);
                var problems   = repository.LoadProblems;
                Assert.That(problems.Count, Is.EqualTo(0));
            }
        }
Пример #3
0
        //This is not really a problem, but it would be nice if the file were made consistant. So make we will make them run it through the migrator, which they should be using anyway.
        public void Constructor_LdmlFolderStoreContainsInconsistentlyNamedFile_HasExpectedProblem()
        {
            using (var environment = new TestEnvironment())
            {
                File.WriteAllText(Path.Combine(environment.TestPath, "tpi-Zxxx-x-audio.ldml"),
                                  LdmlContentForTests.CurrentVersion("de", "latn", "ch", "1901"));

                var repository = new LdmlInFolderWritingSystemRepository(environment.TestPath);
                var problems   = repository.LoadProblems;
                Assert.That(problems.Count, Is.EqualTo(1));
                Assert.That(
                    problems[0].Exception,
                    Is.TypeOf <ApplicationException>().With.Property("Message").
                    ContainsSubstring(String.Format(
                                          @"The writing system file {0} seems to be named inconsistently. It contains the Rfc5646 tag: 'de-latn-ch-1901'. The name should have been made consistent with its content upon migration of the writing systems.",
                                          Path.Combine(environment.TestPath, "tpi-Zxxx-x-audio.ldml")
                                          ))
                    );
            }
        }