【发布时间】:2010-12-27 09:48:10
【问题描述】:
我正在尝试对 WPF 控件进行单元测试,并且需要模拟按键。我已经看到了一个可能的解决方案here,但是当我尝试传入一个 PresentationSource 时,我不断得到一个空值(来自 PresentationSource.FromVisual() 或 PresentationSource.FromDependencyObject()),这会触发一个异常。
我的问题是如何获得可以在单元测试中使用的非 null PresentationSource?
【问题讨论】:
标签: c# .net wpf unit-testing wpf-controls