public async Task ConfirmFinishCommandShouldCallCancelCreationOfTaskServiceAndWontCallUpdateWhenANullTitleIsProvided() { // Arrange string finalTitle = null; Mock.Arrange(() => _habitService.CancelCreation(_habitViewModel)).OccursOnce(); Mock.Arrange(() => _habitService.UpdateAsync(_habitViewModel)).Returns(Task.CompletedTask).OccursNever(); // Act await _habitViewModel.FinishCreationCommand.ExecuteAsync(finalTitle); // Assert Mock.Assert(_habitService); }
public void CancelCreatingHabitRemovesTheHabitFromAllHabitsListAndWontInsertOrUpdateAnythingToTheDatabase() { // Arrange Mock.Arrange(() => _persistance.InsertAsync(Arg.AnyObject)).Returns(Task.CompletedTask).OccursNever(); Mock.Arrange(() => _persistance.UpdateAsync(Arg.AnyObject)).Returns(Task.CompletedTask).OccursNever(); // Act _storage.StartCreation(); _storage.CancelCreation(_storage.AllHabits[0]); // Assert Assert.AreEqual(0, _storage.AllHabits.Count); Mock.Assert(_persistance); }