public async Task ToRpc_Collection_Byte_With_Capabilities_Value()
        {
            var logger       = MockNullLoggerFactory.CreateLogger();
            var capabilities = new Capabilities(logger);
            MapField <string, string> addedCapabilities = new MapField <string, string>
            {
                { RpcWorkerConstants.TypedDataCollection, RpcWorkerConstants.TypedDataCollection }
            };

            capabilities.UpdateCapabilities(addedCapabilities);

            byte[][] arrBytes = new byte[2][];
            arrBytes[0] = new byte[] { 22 };
            arrBytes[1] = new byte[] { 11 };

            TypedData returned_typedata = await arrBytes.ToRpc(logger, capabilities);

            TypedData typedData = new TypedData();

            CollectionBytes collectionBytes = new CollectionBytes();

            foreach (byte[] element in arrBytes)
            {
                if (element != null)
                {
                    collectionBytes.Bytes.Add(ByteString.CopyFrom(element));
                }
            }
            typedData.CollectionBytes = collectionBytes;

            Assert.Equal(typedData.CollectionBytes, returned_typedata.CollectionBytes);
            Assert.Equal(typedData.CollectionBytes.Bytes[0], returned_typedata.CollectionBytes.Bytes[0]);
        }
Пример #2
0
        internal static TypedData ToRpcByteArray(this byte[][] arrBytes)
        {
            TypedData       typedData       = new TypedData();
            CollectionBytes collectionBytes = new CollectionBytes();

            foreach (byte[] element in arrBytes)
            {
                if (element != null)
                {
                    collectionBytes.Bytes.Add(ByteString.CopyFrom(element));
                }
            }
            typedData.CollectionBytes = collectionBytes;

            return(typedData);
        }