Exemple #1
0
            public async ThreadingTask DoesNotReportThatItemsChangedExactlyOnce()

            {
                var observer = TestScheduler.CreateObserver <Unit>();

                TimeEntriesSource.ItemsChanged.Subscribe(observer);
                var timeEntries = Enumerable.Range(0, 10)
                                  .Select(id => new MockTimeEntry {
                    Id = id, IsDeleted = false, At = DateTimeOffset.Now, Duration = 1
                })
                                  .ToList();
                var conflictResolutionResult = Observable.Return(timeEntries.Select(te => new UpdateResult <IDatabaseTimeEntry>(te.Id, te)));

                Repository.BatchUpdate(
                    Arg.Any <IEnumerable <(long, IDatabaseTimeEntry)> >(),
                    Arg.Any <Func <IDatabaseTimeEntry, IDatabaseTimeEntry, ConflictResolutionMode> >(),
                    Arg.Any <IRivalsResolver <IDatabaseTimeEntry> >())
                .Returns(conflictResolutionResult);

                await TimeEntriesSource.BatchUpdate(timeEntries);

                observer.Messages.Should().HaveCount(1);
            }