public void ShouldBeAbleToOverlap() { Payload header = new Payload.Builder() .Value("ver", 0x01) .Build(); Payload body = new Payload.Builder() .Value("message", "Hello, Bryllite!") .Value("rndBytes", RndProvider.GetNonZeroBytes(128)) .Build(); Payload message = new Payload.Builder() .Value("header", header) .Value("body", body) .Build(); Payload received = Payload.Parse(message.ToBytes()); Payload receivedHeader = received.Value <Payload>("header"); Payload receivedBody = received.Value <Payload>("body"); Assert.Equal(message.Hash, received.Hash); Assert.Equal(header.Hash, receivedHeader.Hash); Assert.Equal(body.Hash, receivedBody.Hash); Assert.Equal(header.Value <int>("ver"), receivedHeader.Value <int>("ver")); Assert.Equal(body.Value <string>("message"), receivedBody.Value <string>("message")); Assert.Equal(body.Value <byte[]>("rndBytes"), receivedBody.Value <byte[]>("rndBytes")); }
public void Test1() { Payload payload = new Payload.Builder() .Value("exists", true) .Build(); Assert.True(payload.Value <bool>("exists")); Assert.False(payload.Value <bool>("not exists")); }