public TimeEntryDataSourceTest() { TimeEntriesSource = new TimeEntriesDataSource(IdProvider, Repository); IdProvider.GetNextIdentifier().Returns(-1); Repository.GetById(Arg.Is(DatabaseTimeEntry.Id)).Returns(Observable.Return(DatabaseTimeEntry)); Repository.Create(Arg.Any <IDatabaseTimeEntry>()) .Returns(info => Observable.Return(info.Arg <IDatabaseTimeEntry>())); }
public void CreatesTagWithIdFromIdProvider(long nextId) { IdProvider.GetNextIdentifier().Returns(nextId); createTagInteractor("Some tag", 10).Execute().Wait(); DataSource.Tags.Received().Create( Arg.Is <IThreadSafeTag>(tag => tag.Id == nextId) ).Wait(); }
public async Task CreatesATimeEntryWithAnIdProvidedByTheIdProvider() { IdProvider.GetNextIdentifier().Returns(-1); await CallInteractor(CreatePrototype(ValidTime, ValidDescription, true, ProjectId)); await DataSource.TimeEntries.Received().Create(Arg.Is <IThreadSafeTimeEntry>( te => te.Id == -1 )); }
public void CreatesTagWithIdFromIdProvider(long nextId) { IdProvider.GetNextIdentifier().Returns(nextId); DataSource.Create("Some tag", 10).Wait(); DataBase.Tags.Received().Create( Arg.Is <IDatabaseTag>(tag => tag.Id == nextId) ).Wait(); }
protected TimeEntryDataSourceTest() { TimeEntriesSource = new TimeEntriesDataSource(Repository, TimeService); IdProvider.GetNextIdentifier().Returns(-1); Repository.GetById(Arg.Is(TimeEntry.Id)).Returns(Observable.Return(TimeEntry)); Repository.Create(Arg.Any <IDatabaseTimeEntry>()) .Returns(info => Observable.Return(info.Arg <IDatabaseTimeEntry>())); Repository.Update(Arg.Any <long>(), Arg.Any <IDatabaseTimeEntry>()) .Returns(info => Observable.Return(info.Arg <IDatabaseTimeEntry>())); }