예제 #1
0
        public void Should_Convert_Message_To_SetNicknameCommand_When_WaitingNickaname()
        {
            string      messageSentByClient  = "Joey";
            ClientState currentStateOfClient = ClientState.WaitingNickname;
            Guid        connectionUid        = Guid.NewGuid();

            Command command = Mapper.ToCommand(connectionUid, currentStateOfClient, messageSentByClient);

            Assert.IsAssignableFrom <SetNicknameCommand>(command);
            Assert.AreEqual(messageSentByClient, ((SetNicknameCommand)command).Nickname);
            Assert.AreEqual(connectionUid, ((SetNicknameCommand)command).ConnectionUid);
        }
예제 #2
0
        private async Task Communicator_OnClientSendCommand(Guid connectionUid, string textualCommand)
        {
            ClientState clientState = await DiscoverClientStateAsync(connectionUid);

            Command command = TextualCommandMapper.ToCommand(connectionUid, clientState, textualCommand);

            await ChatFacade.ProcessMessageAsync(command);
        }