public CreateTimeEntryInteractor( IIdProvider idProvider, ITimeService timeService, ITogglDataSource dataSource, IAnalyticsService analyticsService, ITimeEntryPrototype prototype, DateTimeOffset startTime, TimeSpan?duration, TimeEntryStartOrigin origin) { Ensure.Argument.IsNotNull(origin, nameof(origin)); Ensure.Argument.IsNotNull(prototype, nameof(prototype)); Ensure.Argument.IsNotNull(idProvider, nameof(idProvider)); Ensure.Argument.IsNotNull(dataSource, nameof(dataSource)); Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService)); this.origin = origin; this.duration = duration; this.prototype = prototype; this.startTime = startTime; this.idProvider = idProvider; this.dataSource = dataSource; this.timeService = timeService; this.analyticsService = analyticsService; }
public void ConvertsTheOriginToAString(TimeEntryStartOrigin origin) { StartTimeEntryEvent startTimeEntryEvent = createTimeEntryEvent(origin); var eventToDictionaryResult = startTimeEntryEvent.ToDictionary(); eventToDictionaryResult[nameof(StartTimeEntryEvent.Origin)].Should().Be(origin.ToString()); }
public static StartTimeEntryEvent With(TimeEntryStartOrigin origin, ITimeEntry timeEntry) => new StartTimeEntryEvent( origin, string.IsNullOrWhiteSpace(timeEntry.Description), timeEntry.ProjectId != null, timeEntry.TaskId != null, timeEntry.TagIds.Count(), timeEntry.Billable, timeEntry.IsRunning());
public StartTimeEntryEvent( TimeEntryStartOrigin origin, bool hasEmptyDescription, bool hasProject, bool hasTask, int numberOfTags, bool isBillable, bool isRunning) { Origin = origin; HasEmptyDescription = hasEmptyDescription; HasProject = hasProject; HasTask = hasTask; NumberOfTags = numberOfTags; IsBillable = isBillable; IsRunning = isRunning; }
public void OnTimeEntryStarted(IThreadSafeTimeEntry timeEntry, TimeEntryStartOrigin origin) { switch (origin) { case TimeEntryStartOrigin.ContinueMostRecent: timeEntryContinuedSubject.OnNext(timeEntry); break; case TimeEntryStartOrigin.Manual: case TimeEntryStartOrigin.Timer: timeEntryStartedSubject.OnNext(timeEntry); break; case TimeEntryStartOrigin.Suggestion: suggestionStartedSubject.OnNext(timeEntry); break; } }
public IInteractor <IObservable <IThreadSafeTimeEntry> > CreateTimeEntry(ITimeEntryPrototype prototype, TimeEntryStartOrigin origin) => new CreateTimeEntryInteractor( idProvider, timeService, dataSource, analyticsService, intentDonationService, prototype, syncManager, prototype.StartTime, prototype.Duration, origin);
private StartTimeEntryEvent createTimeEntryEvent(TimeEntryStartOrigin origin = TimeEntryStartOrigin.SingleTimeEntryContinueButton, bool valueForBooleans = false, int numberOfTags = 0) => new StartTimeEntryEvent(origin, valueForBooleans, valueForBooleans, valueForBooleans, numberOfTags, valueForBooleans, valueForBooleans);
public void SetsTheOriginPropertyProperly(TimeEntryStartOrigin origin) { StartTimeEntryEvent startTimeEntryEvent = StartTimeEntryEvent.With(origin, TimeEntry); startTimeEntryEvent.Origin.Should().Be(origin); }
public static Func <IThreadSafeTimeEntry, StartTimeEntryEvent> With(TimeEntryStartOrigin origin) => timeEntry => With(origin, timeEntry);
public void TrackStartedTimeEntry(TimeEntryStartOrigin origin) { track(startTimeEntryEventName, originParameter, origin.ToString()); }