コード例 #1
0
		public void TestGetMessageSize()
		{
			const string welcomeMessage = "+OK";
			const string okUsername = "******";
			const string okPassword = "******";
			const string messageSize = "+OK 9 200"; // Message 9 has size 200 octets
			const string serverResponses = welcomeMessage + "\r\n" + okUsername + "\r\n" + okPassword + "\r\n" + messageSize + "\r\n";
			
			Stream inputStream = new MemoryStream(Encoding.ASCII.GetBytes(serverResponses));
			Stream outputStream = new MemoryStream();

			Pop3Client client = new Pop3Client();
			client.Connect(new CombinedStream(inputStream, outputStream));
			client.Authenticate("test", "test");

			// Message 9 should have size 200
			const int expectedOutput = 200;
			int output = client.GetMessageSize(9);

			Assert.AreEqual(expectedOutput, output);
		}