Example #1
0
        public void GetMessageFormatters()
        {
            var se = CreateEndpoint();
            var od = se.Contract.Operations [0];
            var b  = new WebHttpBehaviorExt();

            Assert.IsNotNull(b.DoGetRequestClientFormatter(od, se), "#1");
            Assert.IsNotNull(b.DoGetReplyClientFormatter(od, se), "#2");
            Assert.IsNotNull(b.DoGetRequestDispatchFormatter(od, se), "#3");
            Assert.IsNotNull(b.DoGetReplyDispatchFormatter(od, se), "#4");
        }
Example #2
0
        public void MultipleParameters()
        {
            var behavior = new WebHttpBehaviorExt();
            var cd       = ContractDescription.GetContract(typeof(IMultipleParameters));
            var se       = new ServiceEndpoint(cd, new WebHttpBinding(), new EndpointAddress("http://localhost:8080/"));

            behavior.Validate(se);

            foreach (var od in cd.Operations)
            {
                behavior.DoGetRequestClientFormatter(od, se);
            }
        }
Example #3
0
        public void MultipleParameters2()
        {
            var behavior = new WebHttpBehaviorExt();
            var cd       = ContractDescription.GetContract(typeof(IMultipleParametersGet));
            var se       = new ServiceEndpoint(cd, new WebHttpBinding(), new EndpointAddress("http://localhost:8080/"));

            behavior.Validate(se);

            try {
                foreach (var od in cd.Operations)
                {
                    behavior.DoGetRequestClientFormatter(od, se);
                }
                Assert.Fail("Should result in invalid operation");
            } catch (InvalidOperationException) {
            }
        }
Example #4
0
        public void RequestClientFormatter()
        {
            var se  = CreateEndpoint();
            var od  = se.Contract.Operations [0];
            var b   = new WebHttpBehaviorExt();
            var rcf = b.DoGetRequestClientFormatter(od, se);
            var msg = rcf.SerializeRequest(MessageVersion.None, new object [] { "foo" });
            var hp  = msg.Properties [HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;

            Assert.IsNotNull(hp, "#1");
            Assert.IsTrue(msg.IsEmpty, "#2");
            Assert.AreEqual(String.Empty, hp.QueryString, "#3");
            var mb = msg.CreateBufferedCopy(1000);

            try {
                rcf.DeserializeReply(mb.CreateMessage(), new object [0]);
                Assert.Fail("It should not support reply deserialization");
            } catch (NotSupportedException) {
            }
        }
Example #5
0
		public void MultipleParameters2 ()
		{
			var behavior = new WebHttpBehaviorExt ();
			var cd = ContractDescription.GetContract (typeof (IMultipleParametersGet));
			var se = new ServiceEndpoint (cd, new WebHttpBinding (), new EndpointAddress ("http://localhost:8080/"));
			behavior.Validate (se);

			try {
				foreach (var od in cd.Operations)
					behavior.DoGetRequestClientFormatter (od, se);
				Assert.Fail ("Should result in invalid operation");
			} catch (InvalidOperationException) {
			}
		}
Example #6
0
		public void MultipleParameters ()
		{
			var behavior = new WebHttpBehaviorExt ();
			var cd = ContractDescription.GetContract (typeof (IMultipleParameters));
			var se = new ServiceEndpoint (cd, new WebHttpBinding (), new EndpointAddress ("http://localhost:8080/"));
			behavior.Validate (se);

			foreach (var od in cd.Operations)
				behavior.DoGetRequestClientFormatter (od, se);
		}
Example #7
0
		public void RequestClientFormatter ()
		{
			var se = CreateEndpoint ();
			var od = se.Contract.Operations [0];
			var b = new WebHttpBehaviorExt ();
			var rcf = b.DoGetRequestClientFormatter (od, se);
			var msg = rcf.SerializeRequest (MessageVersion.None, new object [] {"foo"});
			var hp = msg.Properties [HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
			Assert.IsNotNull (hp, "#1");
			Assert.IsTrue (msg.IsEmpty, "#2");
			Assert.AreEqual (String.Empty, hp.QueryString, "#3");
			var mb = msg.CreateBufferedCopy (1000);
			try {
				rcf.DeserializeReply (mb.CreateMessage (), new object [0]);
				Assert.Fail ("It should not support reply deserialization");
			} catch (NotSupportedException) {
			}
		}
Example #8
0
		public void GetMessageFormatters ()
		{
			var se = CreateEndpoint ();
			var od = se.Contract.Operations [0];
			var b = new WebHttpBehaviorExt ();
			Assert.IsNotNull (b.DoGetRequestClientFormatter (od, se), "#1");
			Assert.IsNotNull (b.DoGetReplyClientFormatter (od, se), "#2");
			Assert.IsNotNull (b.DoGetRequestDispatchFormatter (od, se), "#3");
			Assert.IsNotNull (b.DoGetReplyDispatchFormatter (od, se), "#4");
		}