public void TestUnionWithNestedStructArrayTestMethod() { using (var val = new StructNestedInsideUnion()) { using (var val2 = new StructNestedInsideUnion()) { byte[] bytes = Encoding.ASCII.GetBytes("TestUnion1"); sbyte[] sbytes = Array.ConvertAll(bytes, q => Convert.ToSByte(q)); val.SzText = sbytes; byte[] bytes2 = Encoding.ASCII.GetBytes("TestUnion2"); sbyte[] sbytes2 = Array.ConvertAll(bytes2, q => Convert.ToSByte(q)); val2.SzText = sbytes2; UnionWithNestedStructArray unionWithNestedStructArray; unionWithNestedStructArray.NestedStructs = new StructNestedInsideUnion[] { val, val2 }; Assert.AreEqual(2, unionWithNestedStructArray.NestedStructs.Length); string ret = CLI.CLI.UnionWithNestedStructArrayTestMethod(unionWithNestedStructArray); Assert.AreEqual("TestUnion1TestUnion2", ret); } } }
public void TestUnionWithNestedStructTestMethod() { using (var val = new StructNestedInsideUnion()) { byte[] bytes = Encoding.ASCII.GetBytes("TestUnions"); sbyte[] sbytes = Array.ConvertAll(bytes, q => Convert.ToSByte(q)); val.SzText = sbytes; UnionWithNestedStruct unionWithNestedStruct; unionWithNestedStruct.NestedStruct = val; Assert.AreEqual(10, unionWithNestedStruct.NestedStruct.SzText.Length); Assert.AreEqual("TestUnions", unionWithNestedStruct.NestedStruct.SzText); string ret = CLI.CLI.UnionWithNestedStructTestMethod(unionWithNestedStruct); Assert.AreEqual("TestUnions", ret); } }