public void NestedStruct_InnerStructSet()
    {
        var nested = new NestedStructs
        {
            OuterStruct = new OuterStruct
            {
                A           = 100,
                InnerStruct = new InnerStruct {
                    A = 401
                }
            }
        };

        Span <byte> memory = new byte[10240];
        int         size   = FlatBufferSerializer.Default.Serialize(nested, memory);

        var oracle = Oracle.NestedStructs.GetRootAsNestedStructs(
            new FlatBuffers.ByteBuffer(memory.Slice(0, size).ToArray()));

        Assert.NotNull(oracle.Outer);

        var outer = oracle.Outer.Value;

        Assert.Equal(100, outer.A);
        Assert.Equal(401, outer.Inner.A);
    }
예제 #2
0
 private static bool CheckNestedStructs(NestedStructs v)
 {
     return(v.n.n.n.s == "abc");
 }