public async Task TestGetLocalisationReturnsCorrectValuesAsync() { var validLocalisationConfig = Options.Create(new Localisation { Path = "./LocalisationValid" }); var provider = new PropertyBasedLocalisationProvider(validLocalisationConfig, Logger); var result = await provider.GetLocalisationsAsync(); var expected = new Dictionary <Language, Dictionary <LocalisationStringKey, string> > {
public void TestInvalidLocalisationStringKey() { var localisationExlusionPathConfig = Options.Create(new Localisation { Path = "./LocalisationInvalidLocalisationStringKey" }); var provider = new PropertyBasedLocalisationProvider(localisationExlusionPathConfig, Logger); Assert.ThrowsAsync <InvalidOperationException>(async() => await provider.GetLocalisationsAsync()); }
public void TestInitialiseThrowsOnEmptyLocalisationPath() { var emptyLocalisationPathConfig = Options.Create(new Localisation { Path = string.Empty }); var provider = new PropertyBasedLocalisationProvider(emptyLocalisationPathConfig, Logger); Assert.ThrowsAsync <InvalidOperationException>(async() => await provider.GetLocalisationsAsync()); }
public void TestExecludeLocalisationRegex() { var localisationExlusionPathConfig = Options.Create(new Localisation { Path = "./LocalisationInvalidFileName", ExclusionRegex = "invalid" }); var provider = new PropertyBasedLocalisationProvider(localisationExlusionPathConfig, Logger); Assert.DoesNotThrowAsync(async() => await provider.GetLocalisationsAsync()); }