public async ThreadingTask SetsTheUserIsNotNewFlagToFalseInTheStorage() { OnboardingStorage.IsNewUser().Returns(true); await ViewModel.Initialize(); TimeEntryCreatedSubject.OnNext(NewTimeEntry.With((long)TimeSpan.FromHours(1).TotalSeconds)); OnboardingStorage.Received().SetIsNewUser(false); }
public async ThreadingTask SetsTheIsWelcomePropertyToFalse() { OnboardingStorage.IsNewUser().Returns(true); await ViewModel.Initialize(); TimeEntryCreatedSubject.OnNext(NewTimeEntry.With((long)TimeSpan.FromHours(1).TotalSeconds)); ViewModel.IsWelcome.Should().BeFalse(); }
public async ThreadingTask IgnoresTheTimeEntryIfItWasDeleted() { await ViewModel.Initialize(); var newTimeEntry = TimeEntry.DirtyDeleted(NewTimeEntry.With(DateTimeOffset.UtcNow.AddHours(1))); TimeEntryCreatedSubject.OnNext(NewTimeEntry); ViewModel.TimeEntries.Any(c => c.Any(te => te.Id == 21)).Should().BeFalse(); ViewModel.TimeEntries.Aggregate(0, (acc, te) => acc + te.Count).Should().Be(InitialAmountOfTimeEntries); }
public async ThreadingTask AddsTheCreatedTimeEntryToTheList() { await ViewModel.Initialize(); var newTimeEntry = NewTimeEntry.With(DateTimeOffset.UtcNow.AddHours(1)); TimeEntryCreatedSubject.OnNext(newTimeEntry); ViewModel.TimeEntries.Any(c => c.Any(te => te.Id == 21)).Should().BeTrue(); ViewModel.TimeEntries.Aggregate(0, (acc, te) => acc + te.Count).Should().Be(InitialAmountOfTimeEntries + 1); }
//This can happen, for example, if the time entry was just stopped public async ThreadingTask AddsTheTimeEntryIfItWasNotAddedPreviously() { await ViewModel.Initialize(); var newTimeEntry = NewTimeEntry.With((long)TimeSpan.FromHours(1).TotalSeconds); TimeEntryUpdatedSubject.OnNext(new EntityUpdate <IThreadSafeTimeEntry>(newTimeEntry.Id, newTimeEntry)); ViewModel.TimeEntries.Any(c => c.Any(te => te.Id == 21)).Should().BeTrue(); ViewModel.TimeEntries.Aggregate(0, (acc, te) => acc + te.Count).Should().Be(InitialAmountOfTimeEntries + 1); }
public async ThreadingTask AddsTheCreatedTimeEntryToTheList() { await ViewModel.Initialize(); var newTimeEntry = NewTimeEntry.With((long)TimeSpan.FromHours(1).TotalSeconds); TimeEntryCreatedSubject.OnNext(newTimeEntry); ViewModel.TimeEntries.Any(c => c.Any(te => te.Id == 21)).Should().BeTrue(); ViewModel.TimeEntries.Aggregate(0, (acc, te) => acc + te.Count).Should().Be(InitialAmountOfTimeEntries + 1); }
//This can happen, for example, if the time entry was just stopped public async ThreadingTask AddsTheTimeEntryIfItWasNotAddedPreviously() { var stopDate = DateTimeOffset.UtcNow.AddHours(1); await ViewModel.Initialize(); var newTimeEntry = NewTimeEntry.With(stopDate); TimeEntryUpdatedSubject.OnNext((newTimeEntry.Id, newTimeEntry)); ViewModel.TimeEntries.Any(c => c.Any(te => te.Id == 21)).Should().BeTrue(); ViewModel.TimeEntries.Aggregate(0, (acc, te) => acc + te.Count).Should().Be(InitialAmountOfTimeEntries + 1); }