本文整理汇总了C#中MainViewModel.OnImportsSatisfied方法的典型用法代码示例。如果您正苦于以下问题:C# MainViewModel.OnImportsSatisfied方法的具体用法?C# MainViewModel.OnImportsSatisfied怎么用?C# MainViewModel.OnImportsSatisfied使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainViewModel
的用法示例。
在下文中一共展示了MainViewModel.OnImportsSatisfied方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnImportsSatisfiedShouldRetrieveSystemOptions
public void OnImportsSatisfiedShouldRetrieveSystemOptions()
{
var vm = new MainViewModel
{
ProcessBuilderRecentEntries = CreateProcessBuilderRecentEntries(),
EventAggregator = CreateEventAggregator(),
SystemOptionsWrapper = CreateISystemOptionsWrapper()
};
Mock.NonPublic.Arrange(vm, "SetupNotifications").DoNothing();
var getSystemOptionsCalled = false;
Mock.Arrange(() => vm.SystemOptionsWrapper.GetSystemOptions(Arg.IsAny<EventHandler<DataPortalResult<SystemOptionsRetriever>>>())).DoInstead(
() =>
{
getSystemOptionsCalled = true;
});
var asyncCompleted = false;
var taskSource = new TaskCompletionSource<MQ1Principal>();
taskSource.SetResult(Mock.Create<MQ1Principal>(Behavior.Loose));
/*Mock.Arrange(() => MQ1Principal.BeginLoadAsync(Arg.IsAny<string>())).Returns(
() =>
{
asyncCompleted = true;
return taskSource.Task;
}); */
// Act
vm.OnImportsSatisfied();
// Assert
//this.EnqueueConditional(() => asyncCompleted);
this.EnqueueCallback(() => Assert.IsTrue(getSystemOptionsCalled));
this.EnqueueTestComplete();
}
示例2: OnImportSatisfied_WhenCalled_SetsSystemOptions
public void OnImportSatisfied_WhenCalled_SetsSystemOptions()
{
//Arrange
var vm = new MainViewModel();
var communicationServiceMock = Mock.Create<ICommunicationService>();
vm.CommunicationService = communicationServiceMock;
vm.ProcessBuilderRecentEntries = Mock.Create<IRecentEntryList>();
vm.EventAggregator = Mock.Create<IEventAggregator>();
vm.SystemOptionsWrapper = Mock.Create<ISystemOptionsWrapper>();
var systemOptionsRetrieverMock = Mock.Create<SystemOptionsRetriever>();
var sysOptionsMock = Mock.Create<SystemOptionsInfo>();
Mock.Arrange(() => sysOptionsMock.SessionInactivityTimeoutAction).Returns(InactivityTimoutActionEnum.Locked);
Mock.Arrange(() => sysOptionsMock.InactivityMinutes).Returns(5);
Mock.Arrange(() => systemOptionsRetrieverMock.SystemOptions).Returns(sysOptionsMock);
Mock.NonPublic.Arrange(vm, "StartInactivityTimer", ArgExpr.IsAny<SystemOptionsInfo>()).MustBeCalled();
Mock.Arrange(
() =>
vm.SystemOptionsWrapper.GetSystemOptions(
Arg.IsAny<EventHandler<DataPortalResult<SystemOptionsRetriever>>>()))
.DoInstead<EventHandler<DataPortalResult<SystemOptionsRetriever>>>(
callback =>
callback(null,
new DataPortalResult<SystemOptionsRetriever>(systemOptionsRetrieverMock, null, null)));
//Act
vm.OnImportsSatisfied();
//Assert
vm.AssertAll();
}
示例3: SetupNotifications_WhenCommunicationMessageReceived_CallsShowMessage
public void SetupNotifications_WhenCommunicationMessageReceived_CallsShowMessage()
{
var vm = new MainViewModel();
var communicationServiceMock = Mock.Create<ICommunicationService>();
vm.CommunicationService = communicationServiceMock;
vm.ProcessBuilderRecentEntries = Mock.Create<IRecentEntryList>();
vm.EventAggregator = Mock.Create<IEventAggregator>();
vm.SystemOptionsWrapper = Mock.Create<ISystemOptionsWrapper>();
vm.MessageReceiver = new LazyMessageReceiver
{
InnerValue = new Lazy<IMessageReceiver>(Mock.Create<IMessageReceiver>)
};
var adminMessageService = Mock.Create<AdminMessageService>();
Mock.Arrange(() => adminMessageService.ShowMessage(Arg.AnyString, Arg.IsAny<IMessageReceiver>())).MustBeCalled();
vm.TheAdminMessageService = new Lazy<AdminMessageService>(() => adminMessageService);
//Act
vm.OnImportsSatisfied();
Mock.Raise(() => communicationServiceMock.MessageReceived += null, new ValueEventArgs<string>("123"));
//Assert
adminMessageService.AssertAll();
}
示例4: OnImportSatisfied_WhenCalled_SetsUpNotifications
public void OnImportSatisfied_WhenCalled_SetsUpNotifications()
{
//Arrange
var vm = new MainViewModel();
var communicationServiceMock = Mock.Create<ICommunicationService>();
vm.CommunicationService = communicationServiceMock;
vm.ProcessBuilderRecentEntries = Mock.Create<IRecentEntryList>();
vm.EventAggregator = Mock.Create<IEventAggregator>();
vm.SystemOptionsWrapper = Mock.Create<ISystemOptionsWrapper>();
Mock.ArrangeSet(() => communicationServiceMock.MessageReceived += null).IgnoreArguments().OccursOnce();
//Act
vm.OnImportsSatisfied();
//Assert
communicationServiceMock.AssertAll();
}