示例#1
0
        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);
        }
示例#2
0
        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")
                    );
            });
        }
示例#3
0
        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));
        }
示例#4
0
        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")
                    );
            });
        }