Exemple #1
0
        public async Task SetProficiencyAsync_ValidInput_ReturnSuccess()
        {
            // Arrange
            var charProvider = new MockCharacterProvider();
            var statProvider = new MockStatisticProvider();

            var statOptions = new StatisticOptions
            {
                InitialAttributeMin         = 1,
                InitialAttributeMax         = 10,
                InitialAttributePoints      = 40,
                InitialAttributesAtMax      = 7,
                InitialAttributesProficient = 1
            };

            var controller = new StatisticController(charProvider, statProvider, new GenericProgressionStrategy(statProvider, statOptions));
            var character  = await charProvider.GetActiveCharacterAsync(1);

            Statistic str = await statProvider.GetStatisticAsync("strength");

            await controller.SetStatisticAsync(1, "strength", 10);

            // Act
            await controller.SetProficiencyAsync(1, "strength", true);

            // Assert
            Assert.True(character.GetStatistic(str).IsProficient);
        }
Exemple #2
0
        public async Task SetProficiencyAsync_SetFalse_ReturnSuccess()
        {
            // Arrange
            var charProvider = new MockCharacterProvider();
            var statProvider = new MockStatisticProvider();

            var statOptions = new StatisticOptions
            {
                InitialAttributeMin         = 1,
                InitialAttributeMax         = 10,
                InitialAttributePoints      = 40,
                InitialAttributesAtMax      = 7,
                InitialAttributesProficient = 0
            };

            var controller = new StatisticController(charProvider, statProvider, new GenericProgressionStrategy(statProvider, statOptions));
            var character  = await charProvider.GetActiveCharacterAsync(1);

            await controller.SetStatisticAsync(1, "strength", 10);

            // Act
            var result = await controller.SetProficiencyAsync(1, "strength", false);

            // Assert
            Assert.Equal(StatisticResult.StatisticSetSucessfully(), result);
        }
Exemple #3
0
        public async Task SetProficiencyAsync(string statName, bool prof = true)
        {
            var result = await _statController.SetProficiencyAsync(Context.User.Id, statName, prof);

            await ReplyAsync(result.Message);
        }