0

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.

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by coldboyqn
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.