public async ThreadingTask SetstheCreatedTimeEntryAsTheCurrentlyRunningTimeEntry() { var observer = new TestScheduler().CreateObserver <ITimeEntry>(); TimeEntriesSource.CurrentlyRunningTimeEntry.Where(te => te != null).Subscribe(observer); await TimeEntriesSource.Start(ValidTime, ValidDescription, true); var currentlyRunningTimeEntry = observer.Messages.Single().Value.Value; await Repository.Received().Create(Arg.Is <IDatabaseTimeEntry>(te => te.Start == currentlyRunningTimeEntry.Start)); }
public async ThreadingTask EmitsANewEventOnTheTimeEntryCreatedObservable() { var observer = TestScheduler.CreateObserver <ITimeEntry>(); TimeEntriesSource.TimeEntryCreated.Subscribe(observer); await TimeEntriesSource.Start(ValidTime, ValidDescription, true); observer.Messages.Single().Value.Value.Id.Should().Be(-1); observer.Messages.Single().Value.Value.Start.Should().Be(ValidTime); }
public async ThreadingTask RemovesCurrentlyRunningTimeEntryWhenItIsDeleted() { var runningTimeEntriesHistory = new List <IDatabaseTimeEntry>(); TimeEntriesSource.CurrentlyRunningTimeEntry .Subscribe(te => runningTimeEntriesHistory.Add(te)); var timeEntryDto = CreateDto(ValidTime, ValidDescription, true, ProjectId); prepareBatchUpdate(); var timeEntry = await TimeEntriesSource.Start(timeEntryDto); Repository.GetById(Arg.Is(timeEntry.Id)).Returns(Observable.Return(timeEntry)); TimeEntriesSource.Delete(timeEntry.Id).Wait(); runningTimeEntriesHistory.Should().HaveCount(3); runningTimeEntriesHistory[0].Should().Be(null); // originally there is no running time entry (in the repository) runningTimeEntriesHistory[1].Id.Should().Be(timeEntry.Id); runningTimeEntriesHistory[2].Should().Be(null); }
public async ThreadingTask CreatesATimeEntryWithTheProvidedValueForDescription() { await TimeEntriesSource.Start(ValidTime, ValidDescription, true); await Repository.Received().Create(Arg.Is <IDatabaseTimeEntry>(te => te.Description == ValidDescription)); }
public async ThreadingTask CreatesATimeEntryWithTheProvidedValueForBillable(bool billable) { await TimeEntriesSource.Start(ValidTime, ValidDescription, billable); await Repository.Received().Create(Arg.Is <IDatabaseTimeEntry>(te => te.Billable == billable)); }
public async ThreadingTask CreatesADirtyTimeEntry() { await TimeEntriesSource.Start(ValidTime, ValidDescription, true); await Repository.Received().Create(Arg.Is <IDatabaseTimeEntry>(te => te.IsDirty)); }
public async ThreadingTask CreatesANewTimeEntryInTheDatabase() { await TimeEntriesSource.Start(ValidTime, ValidDescription, true); await Repository.Received().Create(Arg.Any <IDatabaseTimeEntry>()); }
public async ThreadingTask CreatesATimeEntryWithAnIdProvidedByTheIdProvider() { await TimeEntriesSource.Start(ValidTime, ValidDescription, true); await Repository.Received().Create(Arg.Is <IDatabaseTimeEntry>(te => te.Id == -1)); }