Example #1
0
        public void ApplyResources()
        {
            TestObject          value     = new TestObject();
            StaticMessageSource msgSource = new StaticMessageSource();

            msgSource.ApplyResources(value, "testObject", CultureInfo.InvariantCulture);
            Assert.AreEqual("Mark", value.Name, "Name property value not applied.");
            Assert.AreEqual(35, value.Age, "Age property value not applied.");
        }
Example #2
0
        public void ApplyResourcesWithNullObject()
        {
            TestObject          value     = new TestObject();
            StaticMessageSource msgSource = new StaticMessageSource();

            msgSource.ApplyResources(null, "testObject", CultureInfo.InvariantCulture);
            Assert.AreEqual(null, value.Name);
            Assert.AreEqual(0, value.Age);
        }
Example #3
0
        public void ApplyResourcesWithNullLookupKey()
        {
            TestObject          value     = new TestObject();
            StaticMessageSource msgSource = new StaticMessageSource();

            try
            {
                msgSource.ApplyResources(value, null, CultureInfo.InvariantCulture);
                Assert.Fail("ArgumentNullException was expected");
            } catch (ArgumentNullException e)
            {
                Assert.IsNotNull(e);
            }
            Assert.AreEqual(null, value.Name);
            Assert.AreEqual(0, value.Age);
        }