Exemple #1
0
        public void ShouldWriteMultipleFragments()
        {
            var buffer = new ViewBufferTextWriterContent();

            buffer.Write("ab");
            buffer.Write("cd");

            var result = Serialize(buffer);

            Assert.Equal("abcd", result);
        }
Exemple #2
0
        public void ShouldWriteMultipleBufferFragmentPages()
        {
            var buffer = new ViewBufferTextWriterContent();

            var capacity = StringBuilderPool.GetInstance().Builder.Capacity;

            buffer.Write(new String('x', capacity - 1).ToCharArray());
            buffer.Write(new String('x', 11).ToCharArray(), 1, 3);
            var result = Serialize(buffer);

            Assert.Equal(capacity + 2, result.Length);
        }
Exemple #3
0
        public void ShouldWriteMultipleStringPages()
        {
            var buffer = new ViewBufferTextWriterContent();

            var capacity = StringBuilderPool.GetInstance().Builder.Capacity;
            var page     = new String('x', capacity);

            buffer.Write(page);
            buffer.Write(page);
            var result = Serialize(buffer);

            Assert.Equal(page + page, result);
        }
Exemple #4
0
        public void ShouldWriteObject()
        {
            var buffer = new ViewBufferTextWriterContent();

            buffer.Write((object)"abcd");

            var result = Serialize(buffer);

            Assert.Equal("abcd", result);
        }
Exemple #5
0
        public void ShouldWriteBuffer()
        {
            var buffer = new ViewBufferTextWriterContent();

            buffer.Write("abcd".ToCharArray());

            var result = Serialize(buffer);

            Assert.Equal("abcd", result);
        }
Exemple #6
0
        public void ShouldWriteChar()
        {
            var buffer = new ViewBufferTextWriterContent();

            buffer.Write('a');

            var result = Serialize(buffer);

            Assert.Equal("a", result);
        }
Exemple #7
0
        public void ShouldWriteString()
        {
            var buffer = new ViewBufferTextWriterContent();

            buffer.Write("<div>");

            var result = Serialize(buffer);

            Assert.Equal("<div>", result);
        }