public void ListsStructTestJSON()
        {
            //Arrange
            complexStructwithStrings s1 = new complexStructwithStrings()
            {
                a = "aaa", strings = new List <string>()
                {
                    "aaa", "bbb", "ccc"
                }, b = "ggg"
            };

            // Act
            NewPayLoad pl = new NewPayLoad("ll");

            pl.AddJSONValue(s1);
            pl.ClosePackage();

            string s123 = pl.BufferInfo;

            byte[]     b   = pl.GetPackage();
            NewPayLoad pl2 = new NewPayLoad(b);

            complexStructwithStrings s2 = pl2.GetJSONValue <complexStructwithStrings>();

            //Assert
            Assert.AreEqual(s1.a, s2.a);
            Assert.AreEqual(s2.strings.Count, s2.strings.Count);
            Assert.AreEqual(s2.strings[0], s2.strings[0]);
            Assert.AreEqual(s2.strings[1], s2.strings[1]);
            Assert.AreEqual(s2.strings[2], s2.strings[2]);
            Assert.AreEqual(s1.b, s2.b);
        }
Exemplo n.º 2
0
        private NewPayLoad RunPlatformAction(NewPayLoad payload)
        {
            // GingerNode needs to remain generic so we have one entry point and delagate the work to the platform handler
            if (mService is IPlatformService platformService)
            {
                NodePlatformAction nodePlatformAction = payload.GetJSONValue <NodePlatformAction>();
                nodePlatformAction.Output = new NodeActionOutput();
                // Verify platformActionData is valid !!!

                platformService.PlatformActionHandler.HandleRunAction(platformService, ref nodePlatformAction);

                NewPayLoad actionResult = CreateActionResult(nodePlatformAction.exInfo, nodePlatformAction.error, nodePlatformAction.Output.OutputValues);
                return(actionResult);
            }

            NewPayLoad err2 = NewPayLoad.Error("RunPlatformAction: service is not supporting IPlatformService cannot delegate to run action ");

            return(err2);
        }