public void SynchronizeAction_LFDataChanged_GlossChanged() { // Setup TestEnvironment.CopyFwProjectTo(testProjectCode, _lDSettings.WebWorkDirectory); _lfProject.IsInitialClone = true; _transferLcmToMongo.Run(_lfProject); IEnumerable <LfLexEntry> originalMongoData = _mongoConnection.GetLfLexEntries(); LfLexEntry lfEntry = originalMongoData.First(e => e.Guid == _testEntryGuid); string unchangedGloss = lfEntry.Senses[0].Gloss["en"].Value; string lfChangedGloss = unchangedGloss + " - changed in LF"; lfEntry.Senses[0].Gloss["en"].Value = lfChangedGloss; _mongoConnection.UpdateRecord(_lfProject, lfEntry); _lDProject = new LanguageDepotMock(testProjectCode, _lDSettings); var lDcache = _lDProject.FieldWorksProject.Cache; var lDLcmEntry = lDcache.ServiceLocator.GetObject(_testEntryGuid) as ILexEntry; Assert.That(lDLcmEntry, Is.Not.Null); Assert.That(lDLcmEntry.SensesOS.Count, Is.EqualTo(2)); Assert.That(lDLcmEntry.SensesOS[0].Gloss.AnalysisDefaultWritingSystem.Text, Is.EqualTo(unchangedGloss)); // Exercise var sutSynchronize = new SynchronizeAction(_env.Settings, _env.Logger); sutSynchronize.Run(_lfProject); // Verify Assert.That(GetGlossFromLcm(_testEntryGuid, 2), Is.EqualTo(lfChangedGloss)); Assert.That(GetGlossFromMongoDb(_testEntryGuid, expectedDeletedEntries: 0), Is.EqualTo(lfChangedGloss)); Assert.That(GetGlossFromLanguageDepot(_testEntryGuid, 2), Is.EqualTo(lfChangedGloss)); }
public ConvertFdoToMongoOptionList ConvertOptionListFromFdo(ILfProject project, string listCode, ICmPossibilityList fdoOptionList, bool updateMongoList = true) { LfOptionList lfExistingOptionList = _conn.GetLfOptionListByCode(project, listCode); var converter = new ConvertFdoToMongoOptionList(lfExistingOptionList, _wsEn, listCode, _env.Logger, _cache.WritingSystemFactory); LfOptionList lfChangedOptionList = converter.PrepareOptionListUpdate(fdoOptionList); if (updateMongoList) { _conn.UpdateRecord(project, lfChangedOptionList, listCode); } return(new ConvertFdoToMongoOptionList(lfChangedOptionList, _wsEn, listCode, _env.Logger, _cache.WritingSystemFactory)); }