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"); }
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); } }
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) { } }
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) { } }
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) { } }
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); }
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) { } }
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"); }