public IMoveResultReceivedServerMessage Create(SendMoveClientMessage moveRequest, IGameMoveResponse moveResponse)
        {
            var responseObject = moveResponse.MoveResponseObject as TestResponseObject;
            var moveResultNotificationObject = new TestMoveResultNotificationObject
            {
                SessionName = moveRequest.SessionName,
                PlayerName = moveRequest.UserName,
                AnsweredCorrect = responseObject.AnsweredCorrect
            };

            return moveResultNotificationObject;
        }
        public IMoveResultReceivedServerMessage Create(SendMoveClientMessage moveRequest, IGameMoveResponse moveResponse)
        {
            var moveResponseObject = moveResponse.MoveResponseObject as IAttemptResult;

            return new GuessMyNumberMoveResultNotificationObject
            {
                SessionName = moveRequest.SessionName,
                PlayerName = moveRequest.UserName,
                Number = moveRequest.MoveInformation,
                Goods = moveResponseObject.Goods,
                Regulars = moveResponseObject.Regulars,
                Bads = moveResponseObject.Bads
            };
        }
        public void UT_When_HandleWinnerGameMove_Then_Success()
        {
            var testMoveObject = new TestMoveObject { Answer = "Test Answer" };
            var testMove = new TestMove(testMoveObject);
            var moveResponse = new TestResponse(new TestResponseObject { IsCorrect = true }) { IsWin = true };
            var moveResultNotificationObject = Mock.Of<IMoveResultReceivedServerMessage>(o => o.SessionName == this.sessionName && o.PlayerName == this.requestPlayer);

            this.sessionServiceMock
                .Setup(s => s.GetByName(It.Is<string>(x => x == this.session.Name)))
                .Returns(this.session)
                .Verifiable();
            this.moveFactoryMock
                .Setup(f => f.Create(It.Is<string>(s => s == this.moveInformation)))
                .Returns(testMove)
                .Verifiable();
            this.moveServiceMock
                .Setup(s => s.Handle(It.Is<string>(x => x == this.session.Name), It.Is<string>(x => x == this.requestPlayer),
                    It.Is<IGameMove<TestMoveObject>>(m => m == testMove)))
                .Returns(moveResponse)
                .Verifiable();
            this.sessionHistoryServiceMock
                .Setup(x => x.Add(It.Is<string>(s => s == this.sessionName),
                    It.Is<string>(s => s == this.requestPlayer),
                    It.Is<ISessionHistoryItem<TestMoveObject, TestResponseObject>>(i => i.Move == testMove.MoveObject
                        && i.Response == moveResponse.MoveResponseObject)))
                .Verifiable();
            this.sessionServiceMock
                    .Setup(s => s.Finish(It.Is<string>(x => x == this.sessionName)))
                    .Verifiable();

            var gameProgressPluginComponent = this.GetGameProgressPluginComponent();
            var gameMoveRequest = new SendMoveClientMessage
            {
                SessionName = this.sessionName,
                UserName = this.requestPlayer,
                MoveInformation = "Test"
            };
            var clientContract = new ClientContract
            {
                Type = GamifyClientMessageType.SendMove,
                Sender = this.requestPlayer,
                SerializedClientMessage = this.serializer.Serialize(gameMoveRequest)
            };
            var canHandle = gameProgressPluginComponent.CanHandleClientMessage(clientContract);

            gameProgressPluginComponent.HandleClientMessage(clientContract);

            this.moveServiceMock.VerifyAll();
            this.sessionServiceMock.VerifyAll();
            this.sessionHistoryServiceMock.VerifyAll();
            this.moveFactoryMock.VerifyAll();
            this.notificationServiceMock.Verify(s => s.SendBroadcast(It.Is<int>(t => t == GamifyServerMessageType.GameFinished),
                    It.Is<object>(o => ((GameFinishedServerMessage)o).SessionName == this.session.Name &&
                    ((GameFinishedServerMessage)o).WinnerPlayerName == this.requestPlayer),
                    It.Is<string>(x => x == this.session.Player2Name),
                    It.Is<string>(x => x == this.session.Player1Name)));

            Assert.IsTrue(canHandle);
        }