private State processOpenCurlyBracket(char ch)
            {
                switch (ch)
                {
                case '{':
                    templateNestingLevel++;
                    buffer.Add(ch);
                    return(State.Template);

                default:
                    buffer.Commit(output);
                    output.Add(ch);
                    return(State.NormalText);
                }
            }
        public void TemporaryBuffer_CommitAfterDicard()
        {
            using var buffer = new TemporaryBuffer <int>(1)
                  {
                      100,
                      200,
                      300
                  };

            buffer.DiscardLast();
            buffer.Add(700);
            buffer.Add(900);
            buffer.Discard();

            var data = new List <int>();

            buffer.Commit(data);

            Assert.Empty(data);
        }
        public void TemporaryBuffer_Commit()
        {
            using var buffer = new TemporaryBuffer <int>(1)
                  {
                      100,
                      200,
                      300
                  };

            buffer.DiscardLast();
            buffer.Add(700);
            buffer.Add(900);

            var data = new List <int>();

            buffer.Commit(data);

            Assert.Equal(new List <int> {
                100, 200, 700, 900
            }, data);
        }