Beispiel #1
0
        public void ReturnNoFreeBotsResultWhenAllBotsAreWorkedOrCrashed()
        {
            dataContext.AddBotWith("plaprobot2", EBotState.Crashed);
            var query = new InviteQuery {
                UserIds = new ulong[] { 123 }
            };

            var result = gameWorker.Invite(query);

            Assert.AreEqual(EGameWorkerResult.NoFreeBots, result, "Test does not return 'NoFreeBots' result.");
        }
        public EGameWorkerResult Invite([FromBody] InviteQuery query)
        {
            if (query.UserIds == null || query.UserIds.Length < 1)
            {
                return(EGameWorkerResult.InvalidQuery);
            }

            var botRepository = new BotRepository(botDataContext);
            var steamClient   = new SteamClient(logger);
            var gameWorker    = new GameWorker(botRepository, logger, steamClient);

            var result = gameWorker.Invite(query);

            return(result);
        }
Beispiel #3
0
        public EGameWorkerResult Invite([FromBody] DebugInviteQuery query)
        {
            var dataContext = new MemoryDataContext();

            dataContext.AddBot(
                new BotModel
            {
                Login    = query.Login,
                Password = query.Password,
                State    = EBotState.Free
            }
                );

            var botRepository = new BotRepository(dataContext);

            var steamClient = new SteamClient(logger);
            var gameWorker  = new GameWorker(botRepository, logger, steamClient);

            var result = gameWorker.Invite(query.InviteSubQuery);

            return(result);
        }