Beispiel #1
0
        private async Task <FarmSetup> CreateValidFarmSetup(ForFarmDbContext context)
        {
            var sBots  = BogusData.ValidBotAccounts.Generate(MaxActiveBots);
            var sMules = BogusData.ValidMuleAccounts.Generate(MaxActiveMules);

            context.Accounts.AddRange(sBots);
            context.Accounts.AddRange(sMules);

            await context.SaveChangesAsync();

            return(await AccountAssigner.AssignAccounts(context, Settings));
        }
Beispiel #2
0
        public async void AssignAccounts_ValidBotsExcess()
        {
            var mules = BogusData.ValidMuleAccounts.Generate(MaxActiveMules);
            var bots  = BogusData.ValidBotAccounts.Generate(MaxActiveBots * 2);

            using (var context = NewContext)
            {
                context.Accounts.AddRange(mules);
                context.Accounts.AddRange(bots);

                await context.SaveChangesAsync();
            }

            var farmSetup = await AccountAssigner.AssignAccounts(NewContext, Settings);

            farmSetup.Should().NotBeNull();
            farmSetup.IsEmpty().Should().BeFalse();
            farmSetup.Bots.Should().HaveCount(MaxActiveBots);
        }
Beispiel #3
0
        public async void AssignAccounts_NotEnoughValidMules()
        {
            var nonMemberMules = BogusData.CreateFaker(true, false, false).Generate(MinActiveMules);
            var bannedMules    = BogusData.CreateFaker(true, true, true).Generate(MinActiveMules);

            var bots = BogusData.CreateFaker(false, true, false).Generate(MaxActiveBots);

            using (var context = NewContext){
                context.Accounts.AddRange(nonMemberMules);
                context.Accounts.AddRange(bannedMules);
                context.Accounts.AddRange(bots);

                await context.SaveChangesAsync();
            }

            var farmSetup = await AccountAssigner.AssignAccounts(NewContext, Settings);

            farmSetup.Should().NotBeNull();
            farmSetup.IsEmpty().Should().BeTrue();
        }