Hi guys!
I got an headache with mutilingual resource cross project.
Let's imagine that I have 2 project:
Project #1: Console
Label.resx
Hello: Hello
Label.vi-VN.resx
Hello: Xin chao
("Xin chao" mean "Hello" in Vietnamese)

In project #1, I make a Main method inside Program class

class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Label.Hello);
            Thread.CurrentThread.CurrentCulture = new CultureInfo("vi-VN");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("vi-VN");
            Console.WriteLine(Label.Hello);
        }
    }

And it output "Hello\nXin chao" as intended.
Project #2: Tests
MS Test project, I assert whether the reference cross project still work fine

[TestMethod()]
        public void MainTest()
        {
            Assert.AreEqual("Hello", Label.Hello);
            Thread.CurrentThread.CurrentCulture = new CultureInfo("vi-VN");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("vi-VN");
            Assert.AreEqual("Xin chao", Label.Hello);

        }

And the test failed. The Label.Hello always return "Hello", despite the change in CurrentUICulture and CurrentCulture.
Anyway to make the test pass?
Thanks.

Look like the situation is too odd for anyone to have any idea about it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.