コード例 #1
0
        public async Task ShouldReturnMultiplier_IfMultipleActiveBoostersExist(
            [Range(0.1f, 5f /*lol*/, 0.1f)] float multiplier, [Random(0.1f, 5f, 1)] float otherMultiplier)
        {
            ulong guildId = 6;
            var   booster = new ActiveBooster
            {
                Multiplier = multiplier
            };
            var otherBooster = new ActiveBooster
            {
                Multiplier = otherMultiplier
            };

            var activeBoosters = new Dictionary <ulong, List <ActiveBooster> >
            {
                { guildId, new List <ActiveBooster> {
                      booster, otherBooster
                  } }
            };

            _boosterService.ActiveBoosters.Returns(activeBoosters);

            var command = new GetBoosterMultiplierCommand
            {
                GuildId = guildId
            };

            var result = await _appFixture.SendAsync(command);

            var sum = multiplier + otherMultiplier;

            result.Should().Be(sum);
        }
コード例 #2
0
        public async Task ShouldReturnOne_IfNoActiveBoostersExist()
        {
            ulong guildId = 6;

            var activeBoosters = new Dictionary <ulong, List <ActiveBooster> >
            {
                { guildId, new List <ActiveBooster>() }
            };

            _boosterService.ActiveBoosters.Returns(activeBoosters);

            var command = new GetBoosterMultiplierCommand
            {
                GuildId = guildId
            };

            var result = await _appFixture.SendAsync(command);

            result.Should().Be(1);
        }