コード例 #1
0
        public void ToStringTest()
        {
            AggregationRequestPayload tag = new AggregationRequestPayload(new TlvTagBuilder(Constants.AggregationRequestPayload.TagType, false, false,
                                                                                            new ITlvTag[]
            {
                new IntegerTag(Constants.PduPayload.RequestIdTagType, false, false, 1),
                new ImprintTag(Constants.AggregationRequestPayload.RequestHashTagType, false, false,
                               new DataHash(HashAlgorithm.Sha2256,
                                            new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 })),
                new IntegerTag(Constants.AggregationRequestPayload.RequestLevelTagType, false, false, 0),
            }).BuildTag());

            AggregationRequestPayload tag2 = new AggregationRequestPayload(new RawTag(tag.Type, tag.NonCritical, tag.Forward, tag.EncodeValue()));

            Assert.AreEqual(tag.ToString(), tag2.ToString());
        }
コード例 #2
0
        public void AggregationRequestPayloadTest()
        {
            AggregationRequestPayload tag = new AggregationRequestPayload(new TlvTagBuilder(Constants.AggregationRequestPayload.TagType, false, false,
                                                                                            new ITlvTag[]
            {
                new IntegerTag(Constants.PduPayload.RequestIdTagType, false, false, 1),
                new ImprintTag(Constants.AggregationRequestPayload.RequestHashTagType, false, false,
                               new DataHash(HashAlgorithm.Sha2256,
                                            new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 })),
                new IntegerTag(Constants.AggregationRequestPayload.RequestLevelTagType, false, false, 2),
            }).BuildTag());

            Assert.AreEqual(1, tag.RequestId, "Unexpected request id");
            Assert.AreEqual(2, tag.RequestLevel, "Unexpected request level");
            Assert.AreEqual(new DataHash(HashAlgorithm.Sha2256, Base16.Decode("0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20")), tag.RequestHash,
                            "Unexpected request hash");
        }