コード例 #1
0
    public void DecodeArrayOfTagsWithNulls()
    {
        var expectedBytes = new byte[] { 21, 6, 3, 10, 1, 0, 10, 3 };
        var array         = new ILTagILInt[] { new ILTagILInt(1), null, new ILTagILInt(3) };
        var compound      = new ILTagArrayOfILTag <ILTagILInt>(array);

        byte[] encodedBytes = compound.EncodedBytes;
        Assert.AreEqual(expectedBytes, encodedBytes);
        using var ms = new MemoryStream(encodedBytes);
        var value = ms.DecodeTagArray <ILTagILInt>();

        Assert.AreEqual(array, value);
    }
コード例 #2
0
    private static void GuaranteeBijectiveBehavior(ILTagBool[] array)
    {
        var ilarray      = new ILTagArrayOfILTag <ILTagBool>(array);
        var encodedBytes = ilarray.EncodedBytes;

        using var ms = new MemoryStream(encodedBytes);
        var value = ms.DecodeTagArray <ILTagBool>();

        CompareArrays <ILTagBool, bool>(array, value);
        var newEncodedBytes = new ILTagArrayOfILTag <ILTagBool>(value).EncodedBytes;

        Assert.AreEqual(encodedBytes, newEncodedBytes);
    }