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);
		}
Esempio n. 2
0
        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);
        }
			internal DirectResponseMessageMock(RequestMessageMock request) {
				this.OriginatingRequest = request;
			}
Esempio n. 4
0
 internal DirectResponseMessageMock(RequestMessageMock request)
 {
     this.OriginatingRequest = request;
 }