コード例 #1
0
        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> > {
コード例 #2
0
        public void TestInvalidLocalisationStringKey()
        {
            var localisationExlusionPathConfig = Options.Create(new Localisation {
                Path = "./LocalisationInvalidLocalisationStringKey"
            });
            var provider = new PropertyBasedLocalisationProvider(localisationExlusionPathConfig, Logger);

            Assert.ThrowsAsync <InvalidOperationException>(async() => await provider.GetLocalisationsAsync());
        }
コード例 #3
0
        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());
        }
コード例 #4
0
        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());
        }