예제 #1
0
        public void GetConvertedDPS_DPSLessThanMillionNoScale()
        {
            var raidBench = new RaidBench()
            {
                DPS = 1000
            };

            raidBench.GetConvertedDPS().Should().Be("1K");
        }
예제 #2
0
        public void GetConvertedDPS_DPSLessThanMillionNoScale2()
        {
            var raidBench = new RaidBench()
            {
                DPS = 9999
            };

            raidBench.GetConvertedDPS().Should().Be("9.999K");
        }
예제 #3
0
        public void GetConvertedDPS_DPSLessThanThousandNoScale3()
        {
            var raidBench = new RaidBench()
            {
                DPS = 999
            };

            raidBench.GetConvertedDPS().Should().Be("999");
        }
예제 #4
0
        public void GetConvertedDPS_DPSMoreThanMillionNoScale3()
        {
            var raidBench = new RaidBench()
            {
                DPS = 85623419
            };

            raidBench.GetConvertedDPS().Should().Be(">=1M");
        }
예제 #5
0
        public void GetConvertedDPS_DPSLessThanThousandNoScale2()
        {
            var raidBench = new RaidBench()
            {
                DPS = 100
            };

            raidBench.GetConvertedDPS().Should().Be("100");
        }
예제 #6
0
        public void GetConvertedDPS_DPSMoreThanMillionNoScale()
        {
            var raidBench = new RaidBench()
            {
                DPS = int.MaxValue
            };

            raidBench.GetConvertedDPS().Should().Be(">=1M");
        }
예제 #7
0
        public void GetConvertedDPS_DPSLessThanMillionNoScale3()
        {
            var raidBench = new RaidBench()
            {
                DPS = 5896
            };

            raidBench.GetConvertedDPS().Should().Be("5.896K");
        }
예제 #8
0
        public void GetConvertedDPS_DPSLessThanThousandWithScale3()
        {
            var raidBench = new RaidBench()
            {
                DPS   = 999,
                Scale = 0.8
            };

            raidBench.GetConvertedDPS(true).Should().Be("799");
        }
예제 #9
0
        public void GetConvertedDPS_DPSMoreThanMillionScale3()
        {
            var raidBench = new RaidBench()
            {
                DPS   = 7854685,
                Scale = 0.8
            };

            raidBench.GetConvertedDPS(true).Should().Be(">=1M");
        }
예제 #10
0
        public void GetConvertedDPS_DPSLessThanMillionWithScale3()
        {
            var raidBench = new RaidBench()
            {
                DPS   = 485687,
                Scale = 0.8
            };

            raidBench.GetConvertedDPS(true).Should().Be("388.549K");
        }
예제 #11
0
        public void GetConvertedDPS_DPSLessThanMillionWithScale2()
        {
            var raidBench = new RaidBench()
            {
                DPS   = 99999,
                Scale = 0.8
            };

            raidBench.GetConvertedDPS(true).Should().Be("79.999K");
        }
예제 #12
0
        public async Task AddBenchAsync(int dps, Role role, Class userClass, Specialization spec, double boonUptime = 0, double scale = 0.8)
        {
            scale.Clamp(0, 1);
            boonUptime.Clamp(0, 100);

            using (var context = new RaidContext())
            {
                await context.Database.EnsureCreatedAsync();

                var guild = await context.Guilds
                            //.Include(x => x.Benches)
                            .AsQueryable()
                            .SingleOrDefaultAsync(x => x.DBDiscordID == Context.Guild.Id.ToString());

                if (guild is null)
                {
                    await ReplyAsync("Guild not found.\nRun startup command first.");

                    return;
                }

                var exists = context.RaidBenches.Any(x => x.Guild == guild &&
                                                     x.Role == role &&
                                                     x.Class == userClass &&
                                                     x.Specialization == spec);
                if (exists)
                {
                    await ReplyAsync("Bench already exists.");

                    return;
                }

                var newBench = new RaidBench()
                {
                    Role           = role,
                    Class          = userClass,
                    Specialization = spec,
                    DPS            = dps,
                    Scale          = scale,
                    Guild          = guild,
                    BoonUptime     = boonUptime
                };

                context.RaidBenches.Add(newBench);
                await context.SaveChangesAsync();
            }

            await ReplyAsync("Bench added.");
        }