コード例 #1
0
 private StatusOrString InitializeSubject(byte[] bytes)
 {
     using (var packet = new StringPacket(bytes))
     {
         return((StatusOrString)packet.Consume());
     }
 }
コード例 #2
0
 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());
         }
     }
 }
コード例 #3
0
 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());
     }
 }
コード例 #4
0
        public void Consume_ShouldThrowNotSupportedException()
        {
            var packet = new StringPacket();

            Assert.Throws <NotSupportedException>(() => { packet.Consume(); });
        }