本文整理汇总了C#中ObjectState.ModifyAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectState.ModifyAttribute方法的具体用法?C# ObjectState.ModifyAttribute怎么用?C# ObjectState.ModifyAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectState
的用法示例。
在下文中一共展示了ObjectState.ModifyAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: It_maps_attribute_values_to_properties
public void It_maps_attribute_values_to_properties()
{
var objectState = new ObjectState(objectId, objectTypeId);
objectState.ModifyAttribute("TextValue", "SomeValue");
objectState.ModifyAttribute("IntValue", 42);
dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(objectState);
var snapshot = objectFacade.GetSnapshot(changeSetId);
var o = snapshot.GetById<TestingObject>(objectId);
Assert.AreEqual("SomeValue", o.TextValue);
Assert.AreEqual(42, o.IntValue);
}
示例2: It_does_not_map_attributes_that_are_not_listed_in_object_type_descriptor
public void It_does_not_map_attributes_that_are_not_listed_in_object_type_descriptor()
{
var objectState = new ObjectState(objectId, objectTypeId);
objectState.ModifyAttribute("NotMappedProperty", 10.5m);
dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(objectState);
var snapshot = objectFacade.GetSnapshot(changeSetId);
var o = snapshot.GetById<TestingObject>(objectId);
Assert.AreEqual(0m, o.NotMappedProperty);
}