Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public async Task ConfirmFinishCommandShouldCallConfirmCreationOfHabitServiceAndWontCallUpdateWhenANotNullOrWhitespaceTitleIsProvided()
        {
            // Arrange
            string finalTitle = "TITLE";

            Mock.Arrange(() => _habitService.ConfirmCreationAsync(_habitViewModel)).Returns(Task.CompletedTask).OccursOnce();
            Mock.Arrange(() => _habitService.UpdateAsync(_habitViewModel)).Returns(Task.CompletedTask).OccursNever();

            // Act
            await _habitViewModel.FinishCreationCommand.ExecuteAsync(finalTitle);

            // Assert
            Mock.Assert(_habitService);
        }