本文整理汇总了C#中MessagePackObject.AsStringUtf8方法的典型用法代码示例。如果您正苦于以下问题:C# MessagePackObject.AsStringUtf8方法的具体用法?C# MessagePackObject.AsStringUtf8怎么用?C# MessagePackObject.AsStringUtf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessagePackObject
的用法示例。
在下文中一共展示了MessagePackObject.AsStringUtf8方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAsStringUtf8_IsNotString
public void TestAsStringUtf8_IsNotString()
{
var target = new MessagePackObject( 0 );
Assert.Throws<InvalidOperationException>( () => target.AsStringUtf8() );
}
示例2: TestAsStringUtf8_EncodingMissmatch
public void TestAsStringUtf8_EncodingMissmatch()
{
var target = new MessagePackObject( Encoding.Unicode.GetBytes( _japanese ) );
Assert.Throws<InvalidOperationException>( () => target.AsStringUtf8() );
}
示例3: TestAsStringUtf8_Null_Success
public void TestAsStringUtf8_Null_Success()
{
var target = new MessagePackObject( default( string ) );
Assert.IsNull( target.AsStringUtf8() );
}
示例4: TestAsStringUtf8_Empty_Success
public void TestAsStringUtf8_Empty_Success()
{
var target = new MessagePackObject( new byte[ 0 ] );
Assert.AreEqual( "", target.AsStringUtf8() );
}
示例5: TestAsStringUtf8_Normal_Success
public void TestAsStringUtf8_Normal_Success()
{
var target = new MessagePackObject( Encoding.UTF8.GetBytes( _japanese ) );
Assert.AreEqual( _japanese, target.AsStringUtf8() );
}
示例6: TestAsStringUtf8_EncodingMissmatch
public void TestAsStringUtf8_EncodingMissmatch()
{
var target = new MessagePackObject( Encoding.Unicode.GetBytes( _japanese ) );
var result = target.AsStringUtf8();
}
示例7: TestAsStringUtf8_IsNotString
public void TestAsStringUtf8_IsNotString()
{
var target = new MessagePackObject( 0 );
target.AsStringUtf8();
}