public void WriteStartObject_EmptyBuffer_StartObject()
        {
            // arrange
            using var writer = new SocketMessageWriter();

            // act
            writer.WriteStartObject();

            // assert
            Encoding.UTF8.GetString(writer.Body.Span).MatchSnapshot();
        }
        private Task TerminateConnectionAsync(
            ISocketConnection connection,
            CancellationToken cancellationToken = default)
        {
            var messageWriter = new SocketMessageWriter();

            messageWriter.WriteStartObject();
            messageWriter.WriteType(MessageTypes.Connection.Terminate);
            messageWriter.WriteEndObject();

            return(connection.SendAsync(messageWriter.Body, cancellationToken));
        }
        public void Reset_ObjectInBuffer_EmptyBuffer()
        {
            // arrange
            using var writer = new SocketMessageWriter();
            writer.WriteStartObject();
            writer.WriteEndObject();

            // act
            writer.Reset();

            // assert
            Assert.True(writer.Body.IsEmpty);
        }