private StatusOrString InitializeSubject(byte[] bytes) { using (var packet = new StringPacket(bytes)) { return((StatusOrString)packet.Consume()); } }
public void Consume_ShouldReturnStatusOrString_When_PacketIsEmpty() { using (var packet = new StringPacket()) { using (var statusOrString = packet.Consume()) { Assert.False(statusOrString.Ok()); Assert.AreEqual(Status.StatusCode.Internal, statusOrString.status.Code()); } } }
public void Consume_ShouldReturnStatusOrString_When_PacketIsNotEmpty() { using (var packet = new StringPacket("abc")) { using (var statusOrString = packet.Consume()) { Assert.True(statusOrString.Ok()); Assert.AreEqual("abc", statusOrString.Value()); } Assert.True(packet.IsEmpty()); } }
public void Consume_ShouldThrowNotSupportedException() { var packet = new StringPacket(); Assert.Throws <NotSupportedException>(() => { packet.Consume(); }); }