public async Task ToRpc_Collection_Double_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);
            double[]  arrDouble         = { 1.1, 2.2 };
            TypedData returned_typedata = await arrDouble.ToRpc(logger, capabilities);

            TypedData typedData = new TypedData();

            CollectionDouble collectionDouble = new CollectionDouble();

            foreach (double element in arrDouble)
            {
                collectionDouble.Double.Add(element);
            }
            typedData.CollectionDouble = collectionDouble;

            Assert.Equal(typedData.CollectionDouble, returned_typedata.CollectionDouble);
            Assert.Equal(typedData.CollectionDouble.Double[0], returned_typedata.CollectionDouble.Double[0]);
        }
예제 #2
0
        internal static TypedData ToRpcDoubleArray(this double[] arrDouble)
        {
            TypedData        typedData        = new TypedData();
            CollectionDouble collectionDouble = new CollectionDouble();

            foreach (double element in arrDouble)
            {
                collectionDouble.Double.Add(element);
            }
            typedData.CollectionDouble = collectionDouble;

            return(typedData);
        }