public void Roundtripping_Works() { using (var e = new TestEnvironment()) { IWritingSystemRepository wsCollectionToBeWritten = GetWritingSystemRepository(e.PathToWritingSystemsFolder); IWritingSystemDefinition ws = TestEnvironment.CreateDetailedWritingSystem("th"); wsCollectionToBeWritten.Set(ws); IWritingSystemDefinition ws2 = TestEnvironment.CreateDetailedWritingSystem("en"); wsCollectionToBeWritten.Set(ws2); wsCollectionToBeWritten.Save(); IWritingSystemRepository loadedWsCollection = GetWritingSystemRepository(e.PathToWritingSystemsFolder); TestEnvironment.AssertWritingSystemCollectionsAreEqual(wsCollectionToBeWritten, loadedWsCollection); } }
public void Load_OnlyLdmlWritingSystemFilesExist_WritingSystemsAreLoadedFromThoseFiles() { using (var e = new TestEnvironment()) { IWritingSystemRepository wsCollectionToBeWritten = GetWritingSystemRepository(e.PathToWritingSystemsFolder); IWritingSystemDefinition ws = TestEnvironment.CreateDetailedWritingSystem("en"); wsCollectionToBeWritten.Set(ws); IWritingSystemDefinition ws2 = TestEnvironment.CreateDetailedWritingSystem("de"); wsCollectionToBeWritten.Set(ws2); wsCollectionToBeWritten.Save(); IWritingSystemRepository loadedWsCollection = GetWritingSystemRepository(e.PathToWritingSystemsFolder); TestEnvironment.AssertWritingSystemCollectionsAreEqual(wsCollectionToBeWritten, loadedWsCollection); } }
public void Load_LdmlWritingSystemsHaveSameIsoCodeButDifferentRegionInfo_DoesNotCrash() { using (var e = new TestEnvironment()) { var wsCollectionToBeWritten = GetWritingSystemRepository(e.PathToWritingSystemsFolder); IWritingSystemDefinition ws = TestEnvironment.CreateDetailedWritingSystem("th"); ws.Region = "BR"; wsCollectionToBeWritten.Set(ws); IWritingSystemDefinition ws2 = TestEnvironment.CreateDetailedWritingSystem("th"); ws2.Region = "AQ"; wsCollectionToBeWritten.Set(ws2); wsCollectionToBeWritten.Save(); var loadedWsCollection = GetWritingSystemRepository(e.PathToWritingSystemsFolder); TestEnvironment.AssertWritingSystemCollectionsAreEqual(wsCollectionToBeWritten, loadedWsCollection); } }
public void Write_LoadedWritingSystemIsDeleted_DeletionIsRoundTripped() { using (var e = new TestEnvironment()) { //Write out two writing systems IWritingSystemRepository wsCollectionToBeWritten = GetWritingSystemRepository(e.PathToWritingSystemsFolder); IWritingSystemDefinition ws = TestEnvironment.CreateDetailedWritingSystem("en"); wsCollectionToBeWritten.Set(ws); IWritingSystemDefinition ws2 = TestEnvironment.CreateDetailedWritingSystem("th"); wsCollectionToBeWritten.Set(ws2); wsCollectionToBeWritten.Save(); //load them up again IWritingSystemRepository loadedWsCollection = GetWritingSystemRepository(e.PathToWritingSystemsFolder); loadedWsCollection.Remove(ws.Id); //remove one loadedWsCollection.Save(); //Now check that it hasn't come back! IWritingSystemRepository loadedWsCollection2 = GetWritingSystemRepository(e.PathToWritingSystemsFolder); Assert.IsFalse(loadedWsCollection2.Contains(ws.Id)); } }