Пример #1
0
        // This depends on when SLDR updates "en-US.ldml" with the revid
        public void GetLdmlFile_NotModified_DoesntDownloadNewFile()
        {
            using (var environment = new TestEnvironment(false))
            {
                // Write
                string       content         = LdmlContentForTests.Version3Identity("en", "", "US", "", "", "12345", "variantName", "", "d9fabd0fa2c615cfdfb3d2b48f403f55145ff16a");
                const string ietfLanguageTag = "en-US";

                // Write content to destination and cache
                File.WriteAllText(Path.Combine(environment.FilePath, ietfLanguageTag + ".ldml"), content);
                File.WriteAllText(Path.Combine(Sldr.SldrCachePath, ietfLanguageTag + ".ldml"), content);

                string filename;
                var    sldrStatus = environment.GetLdmlFile(ietfLanguageTag, out filename);
                if (sldrStatus == SldrStatus.UnableToConnectToSldr)
                {
                    Assert.Ignore("Ignored becuase SLDR is offline.");
                }
                // Call a second time, this should use the Cache now
                sldrStatus = environment.GetLdmlFile(ietfLanguageTag, out filename);
                Assert.That(sldrStatus, Is.EqualTo(SldrStatus.FromCache));
                string filePath = Path.Combine(environment.FilePath, filename);
                AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[@source='cldr']", environment.NamespaceManager);
            }
        }
Пример #2
0
        // This depends on when SLDR updates "en-US.ldml" with the revid
        public void GetLdmlFile_NotModified_DoesntDownloadNewFile()
        {
            using (var environment = new TestEnvironment(false))
            {
                // Write
                string       content         = LdmlContentForTests.Version3Identity("en", "", "US", "", "", "12345", "variantName", "", "d9fabd0fa2c615cfdfb3d2b48f403f55145ff16a");
                const string ietfLanguageTag = "en-US";

                // Write content to destination and cache
                File.WriteAllText(Path.Combine(environment.FilePath, ietfLanguageTag + ".ldml"), content);
                File.WriteAllText(Path.Combine(Sldr.SldrCachePath, ietfLanguageTag + ".ldml"), content);

                string filename;
                Assert.That(environment.GetLdmlFile(ietfLanguageTag, out filename), Is.EqualTo(SldrStatus.FromSldr));
                string filePath = Path.Combine(environment.FilePath, filename);
                AssertThatXmlIn.File(filePath).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[@windowsLCID='12345']", environment.NamespaceManager);
            }
        }