本文整理汇总了C#中Product.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Product.Set方法的具体用法?C# Product.Set怎么用?C# Product.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product.Set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: when_property_set_to_same_existing_value_then_does_not_raise_propertychanged
public void when_property_set_to_same_existing_value_then_does_not_raise_propertychanged()
{
var product = new Product("Product", "IProduct");
product.CreateProperty("key").Value = "foo";
var changed = default(PropertyChangeEventArgs);
product.Events.PropertyChanged += (sender, args) => changed = args;
product.Set("key", "foo");
Assert.Null(changed);
}
示例2: when_setting_property_then_automatically_creates_it_if_missing
public void when_setting_property_then_automatically_creates_it_if_missing()
{
var product = new Product("Foo", "IFoo");
product.Set("IsPublic", true);
Assert.True(product.Get<bool>("IsPublic"));
Assert.NotNull(product.Properties.FirstOrDefault());
Assert.Equal("IsPublic", product.Properties.First().Name);
}
示例3: when_property_changing_then_notifies_component
public void when_property_changing_then_notifies_component()
{
var product = new Product("Product", "IProduct");
product.CreateProperty("key").Value = "foo";
var changing = default(PropertyChangeEventArgs);
product.Events.PropertyChanging += (sender, args) => changing = args;
product.Set("key", "bar");
Assert.NotNull(changing);
Assert.Equal("key", changing.PropertyName);
Assert.Equal("foo", changing.OldValue);
Assert.Equal("bar", changing.NewValue);
}