public void SingleResponseMessageType() {
			this.factory.AddMessageTypes(new MessageDescription[] { MessageDescriptions.Get(typeof(DirectResponseMessageMock), V1) });
			var fields = new Dictionary<string, string> {
				{ "random", "bits" },
			};
			IDirectedProtocolMessage request = new RequestMessageMock(receiver.Location, V1);
			Assert.IsNull(this.factory.GetNewResponseMessage(request, fields));
			fields["Age"] = "18";
			IDirectResponseProtocolMessage response = this.factory.GetNewResponseMessage(request, fields);
			Assert.IsInstanceOf<DirectResponseMessageMock>(response);
			Assert.AreSame(request, response.OriginatingRequest);

			// Verify that we can instantiate a response with a derived-type of an expected request message.
			request = new TestSignedDirectedMessage();
			response = this.factory.GetNewResponseMessage(request, fields);
			Assert.IsInstanceOf<DirectResponseMessageMock>(response);
			Assert.AreSame(request, response.OriginatingRequest);
		}
Exemple #2
0
 public void InsufficientlyProtectedMessageSent()
 {
     var message = new TestSignedDirectedMessage(MessageTransport.Direct);
     message.Recipient = new Uri("http://localtest");
     this.Channel.PrepareResponse(message);
 }