public async Task PopulateAllDaysAsync_ServiceFailure_DoesNotChangeState() { // arrange var tracker = new Tracker { Id = 0 }; var day = new LoggedDay { Id = 0, TrackerId = 0 }; var vm = new TrackerLogViewModel(tracker, new FailingTrackerLogService(), new MockSettingsViewModel()); vm.AllDays.Add(day); // act await vm.PopulateAllDaysAsync(); // assert Assert.Single(vm.AllDays, expected: day); }
public async Task PopulateAllDaysAsync_ServiceFailure_SendsMessage() { // arrange var tracker = new Tracker { Id = 0 }; var vm = new TrackerLogViewModel(tracker, new FailingTrackerLogService(), new MockSettingsViewModel()); bool messageSent = false; MessagingCenter.Subscribe <TrackerLogViewModel>(this, TrackerLogViewModel.DatabaseErrorMessage, sender => messageSent = true); // act await vm.PopulateAllDaysAsync(); // assert Assert.True(messageSent); }