public void testConstructor() { Context context = TestHelpers.getContext(); QuestionAnswerV1_0 questionAnswer = QuestionAnswer.v1_0( forRelationship, questionText, questionDetail, validResponses, requireSignature ); JsonObject msg = questionAnswer.askMsg(context); testAskMessages(msg); }
public void testAsk() { withContext(context => { QuestionAnswerV1_0 questionAnswer = QuestionAnswer.v1_0( forRelationship, questionText, questionDetail, validResponses, requireSignature); byte[] message = questionAnswer.askMsgPacked(context); JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message); Assert.AreEqual( "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/questionanswer/1.0/ask-question", unpackedMessage.getAsString("@type") ); }); }
public void testGetMessageType() { QuestionAnswerV1_0 questionAnswer = QuestionAnswer.v1_0( forRelationship, questionText, questionDetail, validResponses, requireSignature); string msgName = "msg name"; string msgType = Util.getMessageType( Util.COMMUNITY_MSG_QUALIFIER, questionAnswer.family(), questionAnswer.version(), msgName); Assert.AreEqual(msgType, questionAnswer.messageType(msgName)); }
public void testAsk() { withContext(context => { QuestionAnswerV1_0 questionAnswer = QuestionAnswer.v1_0( forRelationship, questionText, questionDetail, validResponses, requireSignature); byte[] message = questionAnswer.askMsgPacked(context); JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message); Assert.AreEqual( Util.COMMUNITY_MSG_QUALIFIER + "/questionanswer/1.0/ask-question", unpackedMessage.getAsString("@type") ); }); }