我是单元测试和模拟的新手,而且耳后仍然湿漉漉的。我正在使用Moq框架,我需要模拟一个集合,以便它生成一个具有我提供的值的成员。有问题的集合类是System.Configuration.SettingsPropertyCollection,其中包含SettingsProperty对象。反过来,SettingsProperty有一个Attributes返回SettingsAttributeDictionary的属性.我需要我的收藏才能产生一个SettingsProperty,在其System.Attribute中有一个自定义属性(源自Attributes.SettingsAttribute