WCF 消息.IsFault
我正在尝试编写一个测试,需要创建一个 Message
对象,并将 IsFault
属性设置为 true。然而,这个属性只有一个 getter。有谁知道创建此属性设置为 true 的消息的最佳方法?
谢谢
I am trying to write a test and need to create a Message
object with the IsFault
property set to true. However, this property only has a getter. Does anyone know the best way to create a message where this property would be set to true?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
Message.CreateMessage()
接受MessageFault
的重载 对象。像下面这样的东西应该有效。Use the
Message.CreateMessage()
overload that accepts aMessageFault
object. Something like the following should work.可能考虑在受保护的、内部的或受保护的内部范围打开的对象上创建一个 setter。即
安德鲁
反射是另一条路线,但我认为第一个解决方案应该有效。
安德鲁
Possibly think about making a setter on the object with a proteced, internal or protected internal scope on. i.e.
Andrew
Reflection is another route, but I would think the first solution should work.
Andrew