コード例 #1
0
    public static void GetStringReadOnlySpanUInt16Test()
    {
        Assert.That(() => MarshalUtilities.GetString(default(ushort[])),
                    Is.Null
                    );

        Assert.That(() => MarshalUtilities.GetString(Array.Empty <ushort>()),
                    Is.EqualTo(string.Empty)
                    );

        Assert.That(() => MarshalUtilities.GetString(new ushort[] { 'A', 'B', 'C' }),
                    Is.EqualTo("ABC")
                    );
    }
コード例 #2
0
    public static void GetStringReadOnlySpanSByteTest()
    {
        Assert.That(() => MarshalUtilities.GetString(default(sbyte[])),
                    Is.Null
                    );

        Assert.That(() => MarshalUtilities.GetString(Array.Empty <sbyte>()),
                    Is.EqualTo(string.Empty)
                    );

        Assert.That(() => MarshalUtilities.GetString(new sbyte[] { (sbyte)'A', (sbyte)'B', (sbyte)'C' }),
                    Is.EqualTo("ABC")
                    );
    }