public void AmqpCodecMultipleTest() { byte[] workBuffer = new byte[2048]; ByteBuffer buffer = new ByteBuffer(workBuffer); Multiple <int> nullValue = null; Multiple <string> oneValue = new Multiple <string>(new string[] { strValue }); Multiple <Guid> twoValues = new Multiple <Guid>(new Guid[] { uuidValue, uuidValue }); Multiple <AmqpSymbol> threeValues = new Multiple <AmqpSymbol>(new AmqpSymbol[] { "sym1", "sym2", "sym3" }); AmqpCodec.EncodeMultiple <int>(nullValue, buffer); AmqpCodec.EncodeMultiple <string>(oneValue, buffer); AmqpCodec.EncodeMultiple <Guid>(twoValues, buffer); AmqpCodec.EncodeMultiple <AmqpSymbol>(threeValues, buffer); Multiple <int> nullDecoded = AmqpCodec.DecodeMultiple <int>(buffer); Multiple <string> oneDecoded = AmqpCodec.DecodeMultiple <string>(buffer); Multiple <Guid> twoDecoded = AmqpCodec.DecodeMultiple <Guid>(buffer); Multiple <AmqpSymbol> threeDecoded = AmqpCodec.DecodeMultiple <AmqpSymbol>(buffer); Assert.True(nullDecoded == null, "the null multiple value is not null"); Assert.True(Multiple <string> .Intersect(oneValue, oneDecoded).Count == 1, "multiple of one string value failed"); Assert.True(Multiple <Guid> .Intersect(twoValues, twoDecoded).Count == 2, "multiple of two uuid values failed"); Assert.True(Multiple <AmqpSymbol> .Intersect(threeValues, threeDecoded).Count == 3, "multiple of three symbol values failed"); }
protected void FindMutualCapabilites(Multiple <AmqpSymbol> desired, Multiple <AmqpSymbol> offered) { this.mutualCapabilities = Multiple <AmqpSymbol> .Intersect(desired, offered); }