public void ChangePropertyAction() { var c = new TestChangePropertyAction(); var item = new ActionItem(); c.TargetObject = item; c.PropertyPath = "MyString"; c.Value = "My value"; c.TestInvoke(); Assert.AreEqual("My value", item.MyString); }
public void ChangePropertyAction_Converts_Value() { var c = new TestChangePropertyAction(); var item = new GenericActionItem <Brush> { }; c.TargetObject = item; c.PropertyPath = "MyProperty"; c.Value = "Red"; c.TestInvoke(); Assert.AreEqual(new SolidColorBrush(Colors.Red).ToString(), item.MyProperty.ToString()); }
public void ChangePropertyAction_Converts_Int() { var c = new TestChangePropertyAction(); var item = new GenericActionItem <int> { }; c.TargetObject = item; c.PropertyPath = "MyProperty"; c.Value = "10"; c.TestInvoke(); Assert.AreEqual(10, item.MyProperty); }
public void ChangePropertyAction_Not_Set_Sub_Item_If_Null() { var c = new TestChangePropertyAction(); var item = new ActionItem { }; c.TargetObject = item; c.PropertyPath = "MyInner.MyInnerString"; c.Value = "My value"; c.TestInvoke(); Assert.AreEqual(null, item.MyInner); }
public void ChangePropertyAction_With_Sub_Item() { var c = new TestChangePropertyAction(); var item = new ActionItem { MyInner = new SubFilteredItem { } }; c.TargetObject = item; c.PropertyPath = "MyInner.MyInnerString"; c.Value = "My value"; c.TestInvoke(); Assert.AreEqual("My value", item.MyInner.MyInnerString); }
public void ChangePropertyAction_With_Culture() { var c = new TestChangePropertyAction(); var item = new GenericActionItem <DateTime>(); var date = new DateTime(2019, 07, 18); var dateAsStringFr = date.ToString(CultureInfo.GetCultureInfo("fr")); // 18/07/2019 00:00:00 c.TargetObject = item; c.PropertyPath = "MyProperty"; c.Value = dateAsStringFr; c.Culture = CultureInfo.GetCultureInfo("fr"); c.TestInvoke(); Assert.AreEqual(date, item.MyProperty); }