private static AggregatorConfigResponsePayload GetAggregatorConfigResponsePayload(ulong?maxLevel, ulong?aggregationAlgorithm, ulong?aggregationPeriod, ulong?maxRequests, IList <string> parentsUris) { List <ITlvTag> tlvTags = new List <ITlvTag>(); if (maxLevel.HasValue) { tlvTags.Add(new IntegerTag(Constants.AggregatorConfigResponsePayload.MaxLevelTagType, false, false, maxLevel.Value)); } if (aggregationAlgorithm.HasValue) { tlvTags.Add(new IntegerTag(Constants.AggregatorConfigResponsePayload.AggregationAlgorithmTagType, false, false, aggregationAlgorithm.Value)); } if (aggregationPeriod.HasValue) { tlvTags.Add(new IntegerTag(Constants.AggregatorConfigResponsePayload.AggregationPeriodTagType, false, false, aggregationPeriod.Value)); } if (maxRequests.HasValue) { tlvTags.Add(new IntegerTag(Constants.AggregatorConfigResponsePayload.MaxRequestsTagType, false, false, maxRequests.Value)); } if (parentsUris != null) { tlvTags.AddRange(parentsUris.Select(uri => new StringTag(Constants.AggregatorConfigResponsePayload.ParentUriTagType, false, false, uri))); } AggregatorConfigResponsePayload payload = TestUtil.GetCompositeTag <AggregatorConfigResponsePayload>(Constants.AggregatorConfigResponsePayload.TagType, tlvTags.ToArray()); return(payload); }
public void AggregatorConfigResponsePayloadOk() { AggregatorConfigResponsePayload conf = new AggregatorConfigResponsePayload(new TlvTagBuilder(Constants.AggregatorConfigResponsePayload.TagType, false, false, new ITlvTag[] { new IntegerTag(Constants.AggregatorConfigResponsePayload.MaxLevelTagType, false, false, 1), new IntegerTag(Constants.AggregatorConfigResponsePayload.AggregationAlgorithmTagType, false, false, 2), new IntegerTag(Constants.AggregatorConfigResponsePayload.AggregationPeriodTagType, false, false, 3), new IntegerTag(Constants.AggregatorConfigResponsePayload.MaxRequestsTagType, false, false, 4), }).BuildTag()); Assert.AreEqual(1, conf.MaxLevel, "Unexpected max requests"); Assert.AreEqual(2, conf.AggregationAlgorithm, "Unexpected calendar first time"); Assert.AreEqual(3, conf.AggregationPeriod, "Unexpected calendar last time"); Assert.AreEqual(4, conf.MaxRequests, "Unexpected max requests"); }