示例#1
0
        public void Read_BufferIsCorrectlyRolled_CorrectXmlReturned()
        {
            //arrange
            var buffer     = new char[5];
            var output     = new StringBuilder();
            var reader     = new StringReader("asd<test><inner>text</inner></test>asd");
            var lexer      = new EmailXmlLexer(reader);
            var textReader = new EmailXmlTextReader(lexer, typeof(SaveReservationDto));

            //act
            var count = textReader.Read(buffer, 0, buffer.Length);

            while (count != 0)
            {
                output.Append(buffer, 0, count);

                buffer = new char[5];
                count  = textReader.Read(buffer, 0, buffer.Length);
            }

            //assert
            Assert.Equal("<SaveReservationDto><test><inner>text</inner></test></SaveReservationDto>", output.ToString());
        }
示例#2
0
        public void Read_EmailFieldWithTagWithValue_CorrectXmlReturned()
        {
            //arrange
            var buffer     = new char[100];
            var reader     = new StringReader("To: Antoine Lloyd <*****@*****.**>\r\nasd<test>text</test>asd");
            var lexer      = new EmailXmlLexer(reader);
            var textReader = new EmailXmlTextReader(lexer, typeof(SaveReservationDto));

            //act
            var count = textReader.Read(buffer, 0, buffer.Length);
            var str   = new string(buffer, 0, count);

            //assert
            Assert.Equal("<SaveReservationDto><test>text</test></SaveReservationDto>", str);
        }
示例#3
0
        public void Read_TextBeforeAndAfterWithNestedTagWithValue_CorrectXmlReturned()
        {
            //arrange
            var buffer     = new char[100];
            var reader     = new StringReader("asd<test><inner>text</inner></test>asd");
            var lexer      = new EmailXmlLexer(reader);
            var textReader = new EmailXmlTextReader(lexer, typeof(SaveReservationDto));

            //act
            var count = textReader.Read(buffer, 0, buffer.Length);
            var str   = new string(buffer, 0, count);

            //assert
            Assert.Equal("<SaveReservationDto><test><inner>text</inner></test></SaveReservationDto>", str);
        }