WriteStringAsBinary() public méthode

Write a string as a UTF-8 encoded array of bytes to the stream as an Erlang binary.
public WriteStringAsBinary ( string s ) : void
s string The string to write.
Résultat void
        public void Can_Parse_RpbErrorResp_In_2_Tuple_With_String()
        {
            byte[] b = null;
            using (var os = new OtpOutputStream())
            {
                os.WriteTupleHead(2);
                os.WriteAtom(TtbErrorDecoder.RpbErrorRespAtom);
                os.WriteStringAsBinary(ErrMsg);
                os.Flush();
                b = os.ToArray();
            }

            var ex = Assert.Throws<RiakException>(() => new TsTtbResp(b));
            Assert.IsTrue(ex.Message.Contains(ErrMsg));
        }
        public void Read_Binary(string want)
        {
            byte[] buf = null;
            using (var os = new OtpOutputStream())
            {
                os.WriteStringAsBinary(want);
                buf = os.ToArray();
            }

            using (var s = new OtpInputStream(buf))
            {
                string got = s.ReadBinaryAsString();
                Assert.AreEqual(want, got);
            }
        }
        public void Write_String_As_Binary(string s)
        {
            byte[] str = Encoding.UTF8.GetBytes(s);
            byte[] want = BuildBinBuffer(str);
            byte[] got;
            using (var os = new OtpOutputStream())
            {
                os.WriteStringAsBinary(s);
                Assert.AreEqual(want.Length, os.Position);
                got = os.ToArray();
            }

            CollectionAssert.AreEqual(want, got);
        }