Esempio n. 1
0
        public async Task DeleteStatistic_ValidInput_ReturnSuccess()
        {
            // Arrange
            var charProvider = new MockCharacterProvider();
            var statProvider = new MockStatisticProvider();
            var controller   = new StatisticController(charProvider, statProvider, new GenericProgressionStrategy(statProvider, new StatisticOptions()));

            // Act
            var result = await controller.DeleteStatisticAsync("strength");

            // Assert
            Assert.Equal(result, StatisticResult.StatisticDeletedSuccessfully());
        }
Esempio n. 2
0
        /// <summary>
        /// Deletes a statistic in the database.
        /// </summary>
        /// <param name="statName">The name for the new skill.</param>
        /// A result detailing if the operation was successful or why it failed.
        /// </returns>
        public async Task <IResult> DeleteStatisticAsync(string statName)
        {
            var statistic = await _statProvider.GetStatisticAsync(statName);

            if (statistic == null)
            {
                return(StatisticResult.StatisticNotFound());
            }

            await _statProvider.DeleteStatisticAsync(statistic);

            return(StatisticResult.StatisticDeletedSuccessfully());
        }