Exemple #1
0
        public async Task GetSheet_WhenSheetNameIsEmptyAndLangIsEn_ReturnsDataOfFirstSheet()
        {
            // arrange
            var i18nLocalStore = new I18nLocalStore(System.IO.Path.GetRandomFileName());
            await i18nLocalStore.SaveSheets(_sheets);

            // act & assert
            Assert.ThrowsAsync <ArgumentNullException>(
                async() => await i18nLocalStore.GetSheet(_spreadsheetId, "")
                );
        }
Exemple #2
0
        public async Task GetSheet_WhenSheetNameIsUnknown_ReturnsNull()
        {
            // arrange
            var i18nLocalStore = new I18nLocalStore(System.IO.Path.GetRandomFileName());
            await i18nLocalStore.SaveSheets(_sheets);

            // act
            var sheet = await i18nLocalStore.GetSheet(_spreadsheetId, "NonExistingSheetName");

            // assert
            Assert.IsNull(sheet);
        }
Exemple #3
0
        public async Task GetSheet_WhenLangIsEn_ReturnsEnglishData()
        {
            // arrange
            var i18nLocalStore = new I18nLocalStore(System.IO.Path.GetRandomFileName());
            await i18nLocalStore.SaveSheets(_sheets);

            // act
            var i18nSheet = await i18nLocalStore.GetSheet(_spreadsheetId, "Global");

            // assert
            var objectTree = i18nSheet.GetTranslations("en");

            Assert.AreEqual("Home", objectTree.GetOrCreateScope("navbar")["home"].ToString());
        }