Ejemplo n.º 1
0
        public void GetMessageDefaultsToCurrentUICulture()
        {
            StaticMessageSource msgSource = new StaticMessageSource();

            msgSource.AddMessage("code", CultureInfo.CurrentUICulture, "{0}");
            Assert.AreEqual("my message", msgSource.GetMessage("code", "my message"), "message");

            try
            {
                msgSource.GetMessage("code", CultureInfo.CurrentCulture);
                Assert.Fail("message");
            }
            catch (NoSuchMessageException)
            {}
        }
Ejemplo n.º 2
0
        public void GetMessageCode()
        {
            StaticMessageSource msgSource = new StaticMessageSource();

            msgSource.AddMessage("code", CultureInfo.CurrentUICulture, "{0} {1}");
            Assert.AreEqual("my message",
                            msgSource.GetMessage("code", CultureInfo.CurrentUICulture, new object[] { "my", "message" }),
                            "message");
        }