Exemplo n.º 1
0
            public async ThreadingTask UpdatesTheTagIds()
            {
                var dto = prepareTest();

                await TimeEntriesSource.Update(dto);

                await Repository.Received().Update(Arg.Is(dto.Id), Arg.Is <IDatabaseTimeEntry>(te => te.TagIds.SequenceEqual(dto.TagIds)));
            }
Exemplo n.º 2
0
            public async ThreadingTask LeavesAllOtherPropertiesUnchanged()
            {
                var dto = prepareTest();

                await TimeEntriesSource.Update(dto);

                await Repository.Received().Update(Arg.Is(dto.Id), Arg.Is <IDatabaseTimeEntry>(te => ensurePropertiesDidNotChange(te)));
            }
Exemplo n.º 3
0
            public async ThreadingTask UpdatesTheBillbaleFlag()
            {
                var dto = prepareTest();

                await TimeEntriesSource.Update(dto);

                await Repository.Received().Update(Arg.Is(dto.Id), Arg.Is <IDatabaseTimeEntry>(te => te.Billable == dto.Billable));
            }
Exemplo n.º 4
0
            public async ThreadingTask UpdatesTheProjectId()
            {
                var dto = prepareTest();

                await TimeEntriesSource.Update(dto);

                await Repository.Received().Update(Arg.Is(dto.Id), Arg.Is <IDatabaseTimeEntry>(te => te.ProjectId == dto.ProjectId));
            }
Exemplo n.º 5
0
            public async ThreadingTask UpdatesTheSyncStatusProperty()
            {
                var dto = prepareTest();

                await TimeEntriesSource.Update(dto);

                await Repository.Received().Update(Arg.Is(dto.Id), Arg.Is <IDatabaseTimeEntry>(te => te.SyncStatus == SyncStatus.SyncNeeded));
            }
Exemplo n.º 6
0
            public async ThreadingTask UpdatesTheDescriptionProperty()
            {
                var dto = prepareTest();

                await TimeEntriesSource.Update(dto);

                await Repository.Received().Update(Arg.Is(dto.Id), Arg.Is <IDatabaseTimeEntry>(te => te.Description == dto.Description));
            }
Exemplo n.º 7
0
            public async ThreadingTask UpdatesTheAtProperty()
            {
                var dto = prepareTest();

                TimeService.CurrentDateTime.Returns(DateTimeOffset.Now);

                await TimeEntriesSource.Update(dto);

                await Repository.Received().Update(Arg.Is(dto.Id), Arg.Is <IDatabaseTimeEntry>(te => te.At > DatabaseTimeEntry.At));
            }
Exemplo n.º 8
0
            public async ThreadingTask NotifiesAboutTheUpdate()
            {
                var observable = Observable.Return(DatabaseTimeEntry);

                Repository.GetById(Arg.Is(DatabaseTimeEntry.Id)).Returns(observable);
                var dto = new EditTimeEntryDto {
                    Id = DatabaseTimeEntry.Id, Description = "New description", StartTime = DateTimeOffset.UtcNow, WorkspaceId = 71
                };
                var observer = Substitute.For <IObserver <(long, IDatabaseTimeEntry)> >();

                TimeEntriesSource.TimeEntryUpdated.Subscribe(observer);

                await TimeEntriesSource.Update(dto);

                observer.Received().OnNext(Arg.Is <(long Id, IDatabaseTimeEntry)>(te => te.Id == dto.Id));
            }