예제 #1
0
        public async Task RemoveCommandAfterAcceptingAlertShouldCallDeleteAsyncOfTaskService()
        {
            // Arrange
            Mock.Arrange(() => _navigationService.DisplayAlert(Arg.AnyString, Arg.AnyString, Arg.AnyString, Arg.AnyString)).Returns(Task.FromResult(true)).InOrder();
            Mock.Arrange(() => _habitService.DeleteAsync(_habitViewModel)).Returns(Task.CompletedTask).InOrder().OccursOnce();

            // Act
            await _habitViewModel.DeleteCommand.ExecuteAsync(null);

            // Assert
            Mock.Assert(_habitService);
        }
예제 #2
0
        public async Task DeleteHabitCallsDeleteOnThePersistance()
        {
            // Arrange
            Mock.Arrange(() => _persistance.DeleteAsync(Arg.AnyObject)).Returns(Task.CompletedTask).OccursOnce();

            // Act
            _storage.StartCreation();
            var habit = _storage.AllHabits[0];
            await _storage.ConfirmCreationAsync(habit);

            await _storage.DeleteAsync(habit);

            // Assert
            Mock.Assert(_persistance);
        }