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."); }
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); }
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); }