internal List <NewPayLoad> GetOutpuValuesPayLoad(List <NodeActionOutputValue> AOVs) { List <NewPayLoad> OutputValuesPayLoad = new List <NewPayLoad>(); foreach (NodeActionOutputValue AOV in AOVs) { NewPayLoad PLO = new NewPayLoad(SocketMessages.ActionOutputValue); PLO.AddValue(AOV.Param); PLO.AddValue(AOV.Path); PLO.AddEnumValue(AOV.GetParamType()); switch (AOV.GetParamType()) { case NodeActionOutputValue.OutputValueType.String: PLO.AddValue(AOV.ValueString); break; case NodeActionOutputValue.OutputValueType.ByteArray: PLO.AddBytes(AOV.ValueByteArray); break; // TODO: add other types default: throw new Exception("Unknown output Value Type - " + AOV.GetParamType()); } PLO.ClosePackage(); OutputValuesPayLoad.Add(PLO); } return(OutputValuesPayLoad); }
public void ComplexEnumStringsInts() { //Arrange int vala = 123; int valb = 545; string valsa = "String1"; string valsb = "ZXCVFDSW"; eLocateBy loc = eLocateBy.ByName; NewPayLoad pl = new NewPayLoad("ComplexEnumStringsInts"); pl.AddValue(vala); pl.AddValue(valb); pl.AddValue(valsa); pl.AddValue(valsb); pl.AddEnumValue(loc); pl.ClosePackage(); // Act byte[] b = pl.GetPackage(); NewPayLoad pl2 = new NewPayLoad(b); int vala2 = pl2.GetValueInt(); int valb2 = pl2.GetValueInt(); string valsa2 = pl2.GetValueString(); string valsb2 = pl2.GetValueString(); string Loc2 = pl2.GetValueEnum(); //Assert Assert.AreEqual(vala, vala2); Assert.AreEqual(valb, valb2); Assert.AreEqual(valsa, valsa2); Assert.AreEqual(valsb, valsb2); Assert.AreEqual(loc.ToString(), Loc2); }