鉴于以下模拟创作
_mockSlaTimer = new Mock<IMPulse>();
_mockDataService = new Mock<IDataService>();
_mockDialogService = new Mock<IDialogService>();
_mockViewLocator = new Mock<IViewLocator<IPage>>();
_mockInsightsProvider = new Mock<IInsightService>();
_mockNavigationService = new Mock<INavigationService>();
_mockViewLocator.Object
属性始终为null
接口定义没什么特别的:
public interface IPage
{
}
public interface IViewLocator<TPageType> where TPageType : IPage
{
void RegisterViewFor<TViewModelType>(TPageType page) where TViewModelType : IViewModel;
TPageType ResolveViewFor<TViewModelType>() where TViewModelType : IViewModel;
}
请注意下面的屏幕抓取
为什么object属性会返回null?