Beispiel #1
0
        private TutorialPage4ViewModel CreateViewModel()
        {
            var vm = new TutorialPage4ViewModel(
                _mockNavigationService.Object,
                _mockDialogService.Object,
                _mockLoggerService.Object,
                _mockAbsExposureNotificationApiService.Object
                );

            return(vm);
        }
Beispiel #2
0
        public async Task OnClickEnableTest_NotSupported()
        {
            _mockAbsExposureNotificationApiService.Setup(x => x.StartExposureNotificationAsync()).ThrowsAsync(new ENException(ENException.Code_Android.FAILED_NOT_SUPPORTED, "Unit test"));
            _mockAbsExposureNotificationApiService.Setup(x => x.GetStatusCodesAsync()).ReturnsAsync(new List <int> {
                { ExposureNotificationStatus.Code_Android.USER_PROFILE_NOT_SUPPORT }
            });

            TutorialPage4ViewModel unitUnderTest = CreateViewModel();
            await unitUnderTest.OnClickEnable.ExecuteAsync();

            _mockAbsExposureNotificationApiService.Verify(x => x.StartExposureNotificationAsync(), Times.Once());
            _mockDialogService.Verify(x => x.ShowUserProfileNotSupportAsync(), Times.Once());
            _mockNavigationService.Verify(x => x.NavigateAsync(It.IsAny <string>(), It.IsAny <INavigationParameters>()), Times.Never());
        }
Beispiel #3
0
        public async Task OnClickEnableTest()
        {
            _mockAbsExposureNotificationApiService.Setup(x => x.StartExposureNotificationAsync()).ReturnsAsync(true);

            TutorialPage4ViewModel unitUnderTest = CreateViewModel();
            await unitUnderTest.OnClickEnable.ExecuteAsync();

            _mockAbsExposureNotificationApiService.Verify(x => x.StartExposureNotificationAsync(), Times.Once());
            _mockNavigationService.Verify(x =>
                                          x.NavigateAsync(nameof(EventLogCooperationPage),
                                                          It.Is <INavigationParameters>(x =>
                                                                                        x.ContainsKey(EventLogCooperationPage.TransitionReasonKey) &&
                                                                                        x.GetValue <EventLogCooperationPage.TransitionReason>(EventLogCooperationPage.TransitionReasonKey) == EventLogCooperationPage.TransitionReason.Tutorial)
                                                          ),
                                          Times.Once()
                                          );
        }
Beispiel #4
0
        public async Task OnClickEnableTest_ENException()
        {
            _mockAbsExposureNotificationApiService.Setup(x => x.StartExposureNotificationAsync()).ThrowsAsync(new ENException(ENException.Code_Android.FAILED, "Unit test"));

            TutorialPage4ViewModel unitUnderTest = CreateViewModel();
            await unitUnderTest.OnClickEnable.ExecuteAsync();

            _mockAbsExposureNotificationApiService.Verify(x => x.StartExposureNotificationAsync(), Times.Once());
            _mockDialogService.Verify(x => x.ShowUserProfileNotSupportAsync(), Times.Never());
            _mockNavigationService.Verify(x =>
                                          x.NavigateAsync(nameof(EventLogCooperationPage),
                                                          It.Is <INavigationParameters>(x =>
                                                                                        x.ContainsKey(EventLogCooperationPage.TransitionReasonKey) &&
                                                                                        x.GetValue <EventLogCooperationPage.TransitionReason>(EventLogCooperationPage.TransitionReasonKey) == EventLogCooperationPage.TransitionReason.Tutorial)
                                                          ),
                                          Times.Once()
                                          );
        }