Example #1
0
        public async void MyTurn_Should_Not_Able_Kong_Board_Pong()
        {
            var context = _f.TestDataContext;

            TileType  circ = TileType.Circle;
            TileValue one  = TileValue.One;

            KongTilesHelper.SetupForPongBoard(context, _f.MainPlayerUserName, circ, one);

            _f.OtherPlayerRound.IsMyTurn = false;
            _f.MainPlayerRound.IsMyTurn  = true;

            var kongCommand = new Kong.Command
            {
                RoundId   = _f.RoundId,
                UserName  = _f.MainPlayerUserName,
                TileType  = circ,
                TileValue = one
            };

            var sut = new Kong.Handler(context, _f.RoundMapper, _f.PointCalculator);

            var ex = await Assert.ThrowsAsync <RestException>(() => sut.Handle(kongCommand, CancellationToken.None));

            Assert.Equal(HttpStatusCode.BadRequest, ex.Code);
        }
Example #2
0
        public async Task KongTile(Kong.Command command)
        {
            string userName = GetUserName();

            command.UserName = userName;
            try
            {
                var updates = await _mediator.Send(command);
                await SendClientRoundUpdates(updates, "UpdateRoundNoLag");
            }
            catch (RestException ex)
            {
                throw new HubException(ex.Message);
            }
        }