Esempio n. 1
0
                public async ThreadingTask RemovesTheTimeEntryIfItWasNotRemovedPreviously()
                {
                    await ViewModel.Initialize();

                    var timeEntryCollection = await DataSource.TimeEntries.GetAll().FirstAsync();

                    var timeEntryToDelete = timeEntryCollection.First();

                    TimeEntryDeletedSubject.OnNext(timeEntryToDelete.Id);

                    ViewModel.TimeEntries.All(c => c.All(te => te.Id != timeEntryToDelete.Id)).Should().BeTrue();
                    ViewModel.TimeEntries.Aggregate(0, (acc, te) => acc + te.Count).Should().Be(InitialAmountOfTimeEntries - 1);
                }
Esempio n. 2
0
                public async ThreadingTask RemovesTheWholeCollectionWhenThereAreNoOtherTimeEntriesLeftForThatDay()
                {
                    await ViewModel.Initialize();

                    var timeEntryCollection     = ViewModel.TimeEntries.First();
                    var timeEntriesToDelete     = new List <TimeEntryViewModel>(timeEntryCollection);
                    var timeEntriesInCollection = timeEntryCollection.Count;

                    foreach (var te in timeEntriesToDelete)
                    {
                        TimeEntryDeletedSubject.OnNext(te.Id);
                    }

                    ViewModel.TimeEntries.All(c => c.Date != timeEntryCollection.Date).Should().BeTrue();
                    ViewModel.TimeEntries.Aggregate(0, (acc, te) => acc + te.Count).Should().Be(InitialAmountOfTimeEntries - timeEntriesInCollection);
                }