/// <summary>
 /// Called when deactivating.
 /// </summary>
 /// <param name="close">Inidicates whether this instance will be closed.</param>
 protected async override void OnDeactivate(bool close)
 {
     if (AlarmSummaryViewModel != null)
     {
         await AlarmSummaryViewModel.Deactivate();
     }
 }
Пример #2
0
        public async void Deactivate_ShouldUnsubscribeFromAlarmChanges()
        {
            AlarmSummaryViewModel viewModel = CreateViewModel();
            await viewModel.Deactivate();

            _provideAlarms.Verify(p => p.UnsubscribeFromAlarmChanges(new Collection <string> {
                _randomModule
            }, viewModel.UpdateAlarms));
        }
Пример #3
0
 /// <summary>
 /// Called when deactivating.
 /// </summary>
 /// <param name="close">Inidicates whether this instance will be closed.</param>
 protected async override void OnDeactivate(bool close)
 {
     RemoveMessage(Common.PlatformEssentials.MessageType.Error,
                   "The module was not properly initialized.\n Please restart the application!");
     base.OnDeactivate(close);
     if (AlarmSummaryViewModel != null)
     {
         await AlarmSummaryViewModel.Deactivate();
     }
 }
Пример #4
0
        public async void Deactivate_OnViewModelGettingExceptionWhenUnsubscribingForAlarmChanges_ShouldNotThrow()
        {
            _provideAlarms
            .Setup(p => p.UnsubscribeFromAlarmChanges(
                       It.IsAny <ICollection <string> >(),
                       It.IsAny <Action <IEnumerable <Alarm>, IEnumerable <Alarm> > >()))
            .Throws(new Exception());
            AlarmSummaryViewModel viewModel = CreateViewModel();

            try { await viewModel.Deactivate(); }
            catch (Exception exception) { Assert.Fail("Should not have thrown exception {0}.", exception); }
        }