コード例 #1
0
        private void onSelectOption(SelectableCalendarNotificationsOptionViewModel selectableOption)
        {
            var enabled = selectableOption.Option != CalendarNotificationsOption.Disabled;

            userPreferences.SetCalendarNotificationsEnabled(enabled);

            if (enabled)
            {
                userPreferences.SetTimeSpanBeforeCalendarNotifications(selectableOption.Option.Duration());
            }

            Close();
        }
コード例 #2
0
            public async Task SavesTheSelectedOption(CalendarNotificationsOption option, bool enabled, int minutes)
            {
                var selectableOption = new SelectableCalendarNotificationsOptionViewModel(option, false);

                ViewModel.SelectOption.Execute(selectableOption);

                TestScheduler.Start();
                UserPreferences.Received().SetCalendarNotificationsEnabled(enabled);

                if (enabled)
                {
                    UserPreferences.Received().SetTimeSpanBeforeCalendarNotifications(Arg.Is <TimeSpan>(arg => arg == TimeSpan.FromMinutes(minutes)));
                }
                else
                {
                    UserPreferences.DidNotReceive().SetTimeSpanBeforeCalendarNotifications(Arg.Any <TimeSpan>());
                }

                await NavigationService.Received().Close(Arg.Any <UpcomingEventsNotificationSettingsViewModel>(), Unit.Default);
            }