Exemple #1
0
 private void toggleCalendarSelection(SelectableUserCalendarViewModel calendar)
 {
     if (SelectedCalendarIds.Contains(calendar.Id))
     {
         SelectedCalendarIds.Remove(calendar.Id);
     }
     else
     {
         SelectedCalendarIds.Add(calendar.Id);
     }
     calendar.Selected = !calendar.Selected;
 }
        private IObservable <Unit> selectCalendar(SelectableUserCalendarViewModel calendar)
        {
            if (SelectedCalendarIds.Contains(calendar.Id))
            {
                SelectedCalendarIds.Remove(calendar.Id);
            }
            else
            {
                SelectedCalendarIds.Add(calendar.Id);
            }

            calendar.Selected = !calendar.Selected;

            return(Observable.Return(Unit.Default));
        }
                public async Task EmitsTrueAfterOneCalendarHasBeenSelected()
                {
                    var observer = Substitute.For <IObserver <bool> >();

                    ViewModel.Done.Enabled.Subscribe(observer);
                    var selectableUserCalendar = new SelectableUserCalendarViewModel(
                        new UserCalendar(),
                        false
                        );

                    ViewModel.SelectCalendar.Execute(selectableUserCalendar);
                    TestScheduler.Start();

                    Received.InOrder(() =>
                    {
                        observer.OnNext(false);
                        observer.OnNext(true);
                    });
                }