Ejemplo n.º 1
0
		public void ReadNextText_MultilineInitialTextStateFollowedByEmpty_Null()
		{
			Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
					"text first\n"));
			SFMReader test = new SFMReader(stream);

			Assert.AreEqual("text first\n", test.ReadInitialText());
			Assert.IsNull(test.ReadNextText());
		}
Ejemplo n.º 2
0
		public void Offset_After5CharactersOfInitialText_5()
		{
			Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
					"hello"));
			SFMReader test = new SFMReader(stream);
			test.ReadInitialText();

			Assert.AreEqual(5, test.Offset);
		}
Ejemplo n.º 3
0
		public void ReadNextTagThenReadInitialText_Throw()
		{
			Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(@"\tag1 some text\tag2"));
			SFMReader test = new SFMReader(stream);
			test.ReadNextTag();
			Assert.Throws<InvalidOperationException>(
				() => test.ReadInitialText());
		}
Ejemplo n.º 4
0
		public void ReadInitialThenReadNextTag()
		{
			Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
					@"text \tag1"));
			SFMReader test = new SFMReader(stream);

			test.ReadInitialText();
			Assert.AreEqual("tag1", test.ReadNextTag());
		}
Ejemplo n.º 5
0
		public void ReadInitialText_MultiLineTagFollowedByText_Empty()
		{
			Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
					"\\tag\ntext"));
			SFMReader test = new SFMReader(stream);

			string token = test.ReadInitialText();
			Assert.AreEqual(string.Empty, token);
		}
Ejemplo n.º 6
0
		public void ReadInitialText_MultiLineTextFollowedByTextAndTag_1stLineAndBeginning2ndLine()
		{
			Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
					"text\nmore text\\tag"));
			SFMReader test = new SFMReader(stream);

			string token = test.ReadInitialText();
			Assert.AreEqual("text\nmore text", token);
		}
Ejemplo n.º 7
0
		public void ReadInitialText_MultiLineTextFollowedByEmpty_1stLine()
		{
			Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
					"text\n"));
			SFMReader test = new SFMReader(stream);

			string token = test.ReadInitialText();
			Assert.AreEqual("text\n", token);
		}
Ejemplo n.º 8
0
		public void ReadInitialText_Empty()
		{
			Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
					@""));
			SFMReader test = new SFMReader(stream);

			string token = test.ReadInitialText();
			Assert.AreEqual("", token);
		}