public void MoveTmpToCache_DraftApproved_RemovesUid() { using (var environment = new TestEnvironment()) { string content = @"<?xml version='1.0' encoding='utf-8'?> <ldml> <identity> <version number='$Revision: 11161 $'/> <generation date='$Date: 2015-01-30 22:33 +0000 $'/> <language type='en'/> <special xmlns:sil='urn://www.sil.org/ldml/0.1'> <sil:identity source='cldr' draft='approved' revid='53d542ba498f40f437f7723e69dcf64dab6c9794' uid='e2ccb575'/> </special> <script type='Latn'/> </identity> </ldml>".Replace("\'", "\""); const string ietfLanguageTag = "en"; string filename = Path.Combine(environment.FilePath, ietfLanguageTag + ".ldml"); // LDML in destination to get uid. File.WriteAllText(filename, content); string cacheFilename = Path.Combine(Sldr.SldrCachePath, ietfLanguageTag + "-e2ccb575.ldml"); // Tmp and "filename + uid" in cache File.WriteAllText(cacheFilename, content); string tempFilename = Path.Combine(Sldr.SldrCachePath, ietfLanguageTag + ".ldml.tmp"); File.WriteAllText(tempFilename, content); Assert.True(File.Exists(cacheFilename)); Sldr.MoveTmpToCache(tempFilename, "e2ccb575"); // file + original uid no longer exists in SLDR cache Assert.True(!File.Exists(cacheFilename)); filename = Path.Combine(environment.FilePath, ietfLanguageTag + ".ldml"); AssertThatXmlIn.File(filename).HasAtLeastOneMatchForXpath("/ldml/identity/language[@type='en']", environment.NamespaceManager); AssertThatXmlIn.File(filename).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[@revid='53d542ba498f40f437f7723e69dcf64dab6c9794']", environment.NamespaceManager); AssertThatXmlIn.File(filename).HasAtLeastOneMatchForXpath("/ldml/identity/special/sil:identity[not(uid)]", environment.NamespaceManager); } }