本文整理汇总了C#中Structure.Increment方法的典型用法代码示例。如果您正苦于以下问题:C# Structure.Increment方法的具体用法?C# Structure.Increment怎么用?C# Structure.Increment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Structure
的用法示例。
在下文中一共展示了Structure.Increment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldThrowWhenSettingUndefinedField
public void ShouldThrowWhenSettingUndefinedField()
{
var schema = new StructureSchema<SchemaFields>()
.Add<int>(SchemaFields.Count)
.Add<string>(SchemaFields.Message);
var structure = new Structure<SchemaFields>(schema);
Assert.DoesNotThrow(() => structure.Set(SchemaFields.Count, 1));
Assert.DoesNotThrow(() => structure.Set(SchemaFields.Message, "hello"));
var ae = Assert.Throws<ArgumentException>(() => structure.Set(SchemaFields.Does_Not_Exist, 1));
Assert.Equal("No such field in schema defined. Field name: Does_Not_Exist", ae.Message);
ae = Assert.Throws<ArgumentException>(() => structure.Set(SchemaFields.Does_Not_Exist, "hello"));
Assert.Equal("No such field in schema defined. Field name: Does_Not_Exist", ae.Message);
ae = Assert.Throws<ArgumentException>(() => structure.Increment(SchemaFields.Does_Not_Exist, 1));
Assert.Equal("No such field in schema defined. Field name: Does_Not_Exist", ae.Message);
}