public void WriteTest()
		{
			var Stream = new ConsumerMemoryStream();
			Stream.WriteByte(1);
			Stream.WriteByte(2);
			Stream.WriteBytes(new byte[] { 3, 4, 5 });
			var ReadedBlock1 = Stream.ReadBytes(3);
			CollectionAssert.AreEqual(ReadedBlock1, new byte[] { 1, 2, 3 });
			Stream.WriteBytes(new byte[] { 6, 7 });
			var ReadedBlock2 = Stream.ReadBytes(4);
			CollectionAssert.AreEqual(ReadedBlock2, new byte[] { 4, 5, 6, 7 });
			Console.WriteLine(Stream.Contents.Implode(","));
			CollectionAssert.AreEqual(Stream.Contents, new byte[] { });
		}
Example #2
0
		public void FastcgiHandlerConstructorTest()
		{
			var ConsumerMemoryStream = new ConsumerMemoryStream();
			WriteBeginRequest(ConsumerMemoryStream);

			var FastcgiHandler = new FastcgiHandler(new FastcgiPipeStream(ConsumerMemoryStream));
			FastcgiHandler.Reader.HandlePacket += delegate(Fastcgi.PacketType Type, ushort RequestId, byte[] Content)
			{
				Assert.AreEqual(Type, Fastcgi.PacketType.FCGI_BEGIN_REQUEST);
				Assert.AreEqual(RequestId, 1);
				Console.WriteLine(Content.Implode(","));
				CollectionAssert.AreEqual(Content, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });

				return true;
			};
			FastcgiHandler.Reader.ReadPacket();
		}