public void GetResourceObjectWithCodeAssumesCurrentUICulture()
        {
            TestObject          value     = new TestObject("Rick", 30);
            StaticMessageSource msgSource = new StaticMessageSource();

            msgSource.AddObject("rick", CultureInfo.InvariantCulture, value);

            // assumes object was previously added using CultureInfo.CurrentUICulture
            TestObject retrieved = (TestObject)
                                   msgSource.GetResourceObject("rick");

            Assert.IsNull(retrieved,
                          "Object previously added to StaticMessageSource " +
                          "(using CultureInfo.InvariantCulture) was (wrongly) retrieved " +
                          "when using same lookup code.");
        }
        public void GetResourceObjectWithCode()
        {
            TestObject          value     = new TestObject("Rick", 30);
            StaticMessageSource msgSource = new StaticMessageSource();

            msgSource.AddObject("rick", CultureInfo.CurrentUICulture, value);

            TestObject retrieved = (TestObject)
                                   msgSource.GetResourceObject("rick");

            Assert.IsNotNull(retrieved,
                             "Object previously added to StaticMessageSource was not retrieved " +
                             "when using same lookup code.");
            Assert.IsTrue(ReferenceEquals(value, retrieved),
                          "Object returned from StaticMessageSource was not the same one " +
                          "that was previously added (it must be).");
        }
        public void GetResourceObjectWithCodeAssumesCurrentUICulture()
        {
            TestObject value = new TestObject("Rick", 30);
            StaticMessageSource msgSource = new StaticMessageSource();
            msgSource.AddObject("rick", CultureInfo.InvariantCulture, value);

            // assumes object was previously added using CultureInfo.CurrentUICulture
            TestObject retrieved = (TestObject)
                                   msgSource.GetResourceObject("rick");
            Assert.IsNull(retrieved,
                          "Object previously added to StaticMessageSource " +
                          "(using CultureInfo.InvariantCulture) was (wrongly) retrieved " +
                          "when using same lookup code.");
        }
        public void GetResourceObjectWithCode()
        {
            TestObject value = new TestObject("Rick", 30);
            StaticMessageSource msgSource = new StaticMessageSource();
            msgSource.AddObject("rick", CultureInfo.CurrentUICulture, value);

            TestObject retrieved = (TestObject)
                                   msgSource.GetResourceObject("rick");
            Assert.IsNotNull(retrieved,
                             "Object previously added to StaticMessageSource was not retrieved " +
                             "when using same lookup code.");
            Assert.IsTrue(ReferenceEquals(value, retrieved),
                          "Object returned from StaticMessageSource was not the same one " +
                          "that was previously added (it must be).");
        }