public void UT_When_HandleGetFinishedGames_Then_Success()
        {
            this.sessionServiceMock
                .Setup(s => s.GetFinished(It.Is<string>(x => x == this.requestPlayer)))
                .Returns(this.sessions)
                .Verifiable();

            var getFinishedGamesClientMessage = new GetFinishedGamesClientMessage
            {
                UserName = this.requestPlayer
            };
            var clientContract = new ClientContract
            {
                Type = GamifyClientMessageType.GetFinishedGames,
                Sender = this.requestPlayer,
                SerializedClientMessage = this.serializer.Serialize(getFinishedGamesClientMessage)
            };

            var gameSelectionPluginComponent = this.GetGameSelectionPluginComponent();
            var canHandle = gameSelectionPluginComponent.CanHandleClientMessage(clientContract);

            gameSelectionPluginComponent.HandleClientMessage(clientContract);

            this.sessionServiceMock.VerifyAll();
            this.notificationServiceMock.Verify(s => s.Send(It.Is<int>(t => t == GamifyServerMessageType.FinishedGamesList),
                It.Is<object>(o => (((FinishedGamesListServerMessage)o).FinishedGamesCount == 2)
                    && ((FinishedGamesListServerMessage)o).PlayerName == this.requestPlayer),
                It.Is<string>(x => x == this.requestPlayer)));

            Assert.IsTrue(canHandle);
        }
Ejemplo n.º 2
0
 public void RequestFinishedGames(GetFinishedGamesClientMessage getFinishedGamesClientMessage)
 {
     this.finishedGamesService.Send(getFinishedGamesClientMessage);
 }