public async Task SaveSheet_WhenDataIsValid_Saves() { // arrange var valueRange = new ValueRange { Values = new List <IList <object> > { new List <object> { "ID", "ru", "en", "ua" }, new List <object> { "btn.Word", "Слово", "word" }, new List <object> { "btn.Work", "Работа", "work" }, new List <object> { "Work", "Работа", "work" } } }; var expectedI18nSheet = new I18nSheet("spreadsheetId1", "sheetName1", valueRange); var i18nLocalStore = new I18nLocalStore(Path.GetRandomFileName()); // act await i18nLocalStore.SaveSheet(expectedI18nSheet); // assert var storedSheet = await i18nLocalStore.GetSheet(expectedI18nSheet.SpreadsheetId, expectedI18nSheet.SheetName); Assert.AreEqual(expectedI18nSheet.SpreadsheetId, storedSheet.SpreadsheetId); Assert.AreEqual(expectedI18nSheet.SheetName, storedSheet.SheetName); Assert.AreEqual(expectedI18nSheet.ValueRange.Values, storedSheet.ValueRange.Values); }
public async Task SaveSheet(I18nSheet sheet) { var backupKey = GetLocalStoreKey(sheet.SpreadsheetId, sheet.SheetName); var backupPath = Path.Combine(_localStoreFolderPath, backupKey); var json = JsonConvert.SerializeObject(sheet); await File.WriteAllTextAsync(backupPath, json); }
public async Task SaveSheet(I18nSheet sheet) { await _i18nLocalStore.SaveSheet(sheet); var cacheKey = GetCacheKey(sheet.SpreadsheetId, sheet.SheetName); _i18nCache.Set(cacheKey, sheet); }