本文整理汇总了C#中PacketReader.Invoking方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.Invoking方法的具体用法?C# PacketReader.Invoking怎么用?C# PacketReader.Invoking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketReader
的用法示例。
在下文中一共展示了PacketReader.Invoking方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrySkipTo_Should_Throw_When_Offset_Is_Negative_In_Segment
public void TrySkipTo_Should_Throw_When_Offset_Is_Negative_In_Segment()
{
var buffer = Helpers.GetRandomBytes(20);
var reader = new PacketReader(buffer, 10, 10);
reader
.Invoking(r => r.TrySkipTo(-1))
.ShouldThrow<ArgumentOutOfRangeException>();
}
示例2: TrySkipTo_Should_Throw_When_Offset_Is_Before_Current_Position
public void TrySkipTo_Should_Throw_When_Offset_Is_Before_Current_Position()
{
var buffer = Helpers.GetRandomBytes(10);
var reader = new PacketReader(buffer);
reader.Skip(5);
reader
.Invoking(r => r.TrySkipTo(1))
.ShouldThrow<ArgumentOutOfRangeException>();
}
示例3: ThrowsAndDoesNotMovePosition
private static void ThrowsAndDoesNotMovePosition(PacketReader reader, Action<PacketReader> action)
{
int expected = reader.Remaining;
reader.Invoking(action).ShouldThrow<PacketReadingException>();
int actual = reader.Remaining;
actual.Should().Be(expected);
}
示例4: ThrowsPreOnReadOperations
private static void ThrowsPreOnReadOperations(PacketReader reader, int skip, int padLength, int byteCount)
{
reader
.Invoking(r => r.Skip(skip))
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadBoolean())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadByte())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadInt16())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadUInt16())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadInt32())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadUInt32())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadInt64())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadUInt64())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadLengthString())
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadPaddedString(padLength))
.ShouldThrow<PacketReadingException>();
reader
.Invoking(r => r.ReadBytes(byteCount))
.ShouldThrow<PacketReadingException>();
}
示例5: ReadPaddedString_Should_Throw_When_Data_Is_Missing
public void ReadPaddedString_Should_Throw_When_Data_Is_Missing()
{
var reader = new PacketReader(new byte[] { 1, 1, 1, 1, 1, 1, 1, 1 });
reader
.Invoking(r => r.ReadPaddedString(13))
.ShouldThrow<PacketReadingException>();
}