Esempio n. 1
0
        public void Respond_CorrectToken_ReturnsCorrectMessage()
        {
            var tokenRequestMessage = new TokenMsg("KnownEmail", "CorrectTokenString");
            //Message received from client
            var messageReceived = JsonConvert.SerializeObject(tokenRequestMessage, _jsonSettings);

            _uut.Respond(messageReceived);

            _tokenMsgResponseSub.Received().HandleTokenMsg(Arg.Any<TokenMsg>(),messageReceived, _tokenKeeperSub);
        }
Esempio n. 2
0
		// Token Messages

		private Message ResponseForTokenMessage(TokenMsg message)
		{
			switch (message.SubMsgType)
			{
			case TokenSubMessageTypes.GetPoolDataRequest:
				return ResponseForGetPoolDataRequest ((GetPoolDataRequestMsg)message);
			case TokenSubMessageTypes.GetPoolInfoRequest:
				return ResponseForGetPoolInfoRequest ((GetPoolInfoRequestMsg)message);
			default:
				return new GeneralResponseMsg (true, true);
			}
		}
Esempio n. 3
0
        public void Respond_InCorrectToken_ReturnsCorrectMessage()
        {
            var tokenRequestMessage = new TokenMsg("KnownEmail", "IncorrectTokenString");
            tokenRequestMessage.Username = "******";
            tokenRequestMessage.TokenString = "IncorrectTokenString";
            //Message received from client
            var messageReceived = JsonConvert.SerializeObject(tokenRequestMessage);
            //Answer from ResponseManager
            var messageSentBack = _uut.Respond(messageReceived);
            //Answer from ResponseManager in serialized form
            var serializedMessage = JsonConvert.SerializeObject(messageSentBack);

            Assert.That(serializedMessage, Is.EqualTo(JsonConvert.SerializeObject(new GeneralResponseMsg(false, false))));
        }