当前位置: 首页>>代码示例>>C#>>正文


C# MainViewModel.OnImportsSatisfied方法代码示例

本文整理汇总了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();
        }
开发者ID:mparsin,项目名称:Elements,代码行数:36,代码来源:MainViewModelTests.cs

示例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();
        }
开发者ID:mparsin,项目名称:Elements,代码行数:34,代码来源:MainViewModelTests.cs

示例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();

        }
开发者ID:mparsin,项目名称:Elements,代码行数:26,代码来源:MainViewModelTests.cs

示例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();
        }
开发者ID:mparsin,项目名称:Elements,代码行数:17,代码来源:MainViewModelTests.cs


注:本文中的MainViewModel.OnImportsSatisfied方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。