예제 #1
0
        public void ItReturnsThePlayedGameIdOfTheNewlyCreatedPlayedGame()
        {
            var actualResponse = this.autoMocker.ClassUnderTest.RecordPlayedGame(this.playedGameMessage, this.applicationUser.CurrentGamingGroupId);

            Assert.That(actualResponse.Content, Is.TypeOf(typeof(ObjectContent <NewlyRecordedPlayedGameMessage>)));
            ObjectContent <NewlyRecordedPlayedGameMessage> content        = actualResponse.Content as ObjectContent <NewlyRecordedPlayedGameMessage>;
            NewlyRecordedPlayedGameMessage newlyRecordedPlayedGameMessage = content.Value as NewlyRecordedPlayedGameMessage;

            Assert.That(newlyRecordedPlayedGameMessage.PlayedGameId, Is.EqualTo(EXPECTED_PLAYED_GAME_ID));
        }
예제 #2
0
        public HttpResponseMessage RecordPlayedGame([FromBody] PlayedGameMessage playedGameMessage, [FromUri] int gamingGroupId)
        {
            var newlyCompletedGame = BuildNewlyPlayedGame(playedGameMessage);

            PlayedGame playedGame = playedGameCreator.CreatePlayedGame(newlyCompletedGame, TransactionSource.RestApi, CurrentUser);
            var        newlyRecordedPlayedGameMessage = new NewlyRecordedPlayedGameMessage
            {
                PlayedGameId = playedGame.Id
            };

            return(Request.CreateResponse(HttpStatusCode.OK, newlyRecordedPlayedGameMessage));
        }
예제 #3
0
        public HttpResponseMessage RecordPlayedGame([FromBody] PlayedGameMessage playedGameMessage, [FromUri] int gamingGroupId)
        {
            var newlyCompletedGame = _transformer.Transform <NewlyCompletedGame>(playedGameMessage);

            newlyCompletedGame.TransactionSource = TransactionSource.RestApi;

            var playedGame = _createPlayedGameComponent.Execute(newlyCompletedGame, CurrentUser);
            var newlyRecordedPlayedGameMessage = new NewlyRecordedPlayedGameMessage
            {
                PlayedGameId  = playedGame.Id,
                GamingGroupId = playedGame.GamingGroupId
            };

            return(Request.CreateResponse(HttpStatusCode.OK, newlyRecordedPlayedGameMessage));
        }