Esempio n. 1
0
        public void LoadFromAssembly_Source1_Titles()
        {
            var set = new ResourceSet();

            set.LoadFromAssembly(typeof(ResourceSetTests).Assembly, "Resources/Source1");

            var    localizer = set.GetLocalizer();
            string value;

            value = localizer.Localize("Title1_Key1UnderT1");
            value.ShouldEqual("This should should be prefixed with the titles' key.");

            value = localizer.Localize("Title1_Title2_Key1UnderT2");
            value.ShouldEqual("This should should be prefixed with both titles' key.");

            value = localizer.Localize("SecondTitle1_Key2UnderT1");
            value.ShouldEqual("This should should be prefixed with the titles' key.");

            value = localizer.Localize("SecondTitle1_SecondTitle2_Key2UnderT2");
            value.ShouldEqual("This should should be prefixed with both titles' key.");

            value = localizer.Localize("SecondTitle1_ThirdTitle2_Key3UnderT2");
            value.ShouldEqual("This should should be prefixed with both titles' key.");

            value = localizer.Localize("Key1AfterTitles");
            value.ShouldEqual("This should not be prefixed.");

            value = localizer.Localize("ThirdTitle1_Key4UnderT1");
            value.ShouldEqual("This should should be prefixed with the titles' key.");

            value = localizer.Localize("ThirdTitle1_FourthTitle2_Key4UnderT2");
            value.ShouldEqual("This should should be prefixed with both titles' key.");
        }
Esempio n. 2
0
        public void LoadFromAssembly_Source1_MultiLineBackslashed2()
        {
            var set = new ResourceSet();

            set.LoadFromAssembly(typeof(ResourceSetTests).Assembly, "Resources/Source1");

            var localizer = set.GetLocalizer();
            var value     = localizer.Localize("MultiLineBs2");

            value.ShouldEqual(@"This is the first line. And here is the second and last one.");
        }
Esempio n. 3
0
        public void LoadFromAssembly_Source1_2DoubleQuoted2()
        {
            var set = new ResourceSet();

            set.LoadFromAssembly(typeof(ResourceSetTests).Assembly, "Resources/Source1");

            var localizer = set.GetLocalizer();
            var value     = localizer.Localize("MultiLine2DQ2");

            value.ShouldEqual("This is the first line \r\nAnd here is the sec\"ond and last one.");
        }
Esempio n. 4
0
        public void LoadFromAssembly_Source1_3DoubleQuoted1()
        {
            var set = new ResourceSet();

            set.LoadFromAssembly(typeof(ResourceSetTests).Assembly, "Resources/Source1");

            var localizer = set.GetLocalizer();
            var value     = localizer.Localize("MultiLine3DQ1");

            value.ShouldEqual(@"This is the first li""ne and la""""st one.");
        }
Esempio n. 5
0
        public void LoadFromAssembly_Source1_LocalizerDefault()
        {
            var set = new ResourceSet();

            set.LoadFromAssembly(typeof(ResourceSetTests).Assembly, "Resources/Source1");

            var localizer = set.GetLocalizer();
            var value     = localizer.Localize("Key1");

            value.ShouldEqual("Value1 en-US");

            value = localizer.Localize("Key2");
            value.ShouldEqual("Value in english");
        }