Author: atsushi
Date: 2008-02-08 02:59:30 -0500 (Fri, 08 Feb 2008)
New Revision: 95222
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Channels/ChangeLog
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Channels/ChangeLog
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Channels/WebMessageEncodingBindingElementTest.cs
Log:
2008-02-08 Atsushi Enomoto <[EMAIL PROTECTED]>
* WebMessageEncodingBindingElement.cs : implemented
BuildChannelFactory() and BuildChannelListener().
* WebMessageEncodingBindingElementTest.cs : test
CanBuildChannelFactory() and CanBuildChannelListener().
Small test for BuildChannelFactory().
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Channels/ChangeLog
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Channels/ChangeLog
2008-02-08 07:51:08 UTC (rev 95221)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Channels/ChangeLog
2008-02-08 07:59:30 UTC (rev 95222)
@@ -1,3 +1,8 @@
+2008-02-08 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * WebMessageEncodingBindingElement.cs : implemented
+ BuildChannelFactory() and BuildChannelListener().
+
2008-02-06 Atsushi Enomoto <[EMAIL PROTECTED]>
* WebBodyFormatMessageProperty.cs, WebContentTypeMapper.cs,
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs
2008-02-08 07:51:08 UTC (rev 95221)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs
2008-02-08 07:59:30 UTC (rev 95222)
@@ -106,19 +106,27 @@
[MonoTODO]
public override IChannelFactory<TChannel>
BuildChannelFactory<TChannel> (BindingContext context)
{
- throw new NotImplementedException ();
+ if (context == null)
+ throw new ArgumentNullException ("context");
+ context.RemainingBindingElements.Add (this);
+ return base.BuildChannelFactory<TChannel> (context);
}
- [MonoTODO]
+ [MonoTODO ("Why is it overriden?")]
public override bool CanBuildChannelListener<TChannel>
(BindingContext context)
{
- throw new NotImplementedException ();
+ if (context == null)
+ throw new ArgumentNullException ("context");
+ return context.CanBuildInnerChannelListener<TChannel>
();
}
[MonoTODO]
public override IChannelListener<TChannel>
BuildChannelListener<TChannel> (BindingContext context)
{
- throw new NotImplementedException ();
+ if (context == null)
+ throw new ArgumentNullException ("context");
+ context.RemainingBindingElements.Add (this);
+ return base.BuildChannelListener<TChannel> (context);
}
public override BindingElement Clone ()
Modified:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Channels/ChangeLog
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Channels/ChangeLog
2008-02-08 07:51:08 UTC (rev 95221)
+++
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Channels/ChangeLog
2008-02-08 07:59:30 UTC (rev 95222)
@@ -1,3 +1,9 @@
+2008-02-08 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * WebMessageEncodingBindingElementTest.cs : test
+ CanBuildChannelFactory() and CanBuildChannelListener().
+ Small test for BuildChannelFactory().
+
2008-02-05 Atsushi Enomoto <[EMAIL PROTECTED]>
* WebMessageEncodingBindingElementTest.cs : added MessageEncoder test.
Modified:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Channels/WebMessageEncodingBindingElementTest.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Channels/WebMessageEncodingBindingElementTest.cs
2008-02-08 07:51:08 UTC (rev 95221)
+++
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Channels/WebMessageEncodingBindingElementTest.cs
2008-02-08 07:59:30 UTC (rev 95222)
@@ -31,5 +31,85 @@
Assert.AreEqual ("application/xml", e.MediaType, "#1");
Assert.AreEqual ("application/xml; charset=utf-8",
e.ContentType, "#2");
}
+
+ BindingContext CreateBindingContext ()
+ {
+ return new BindingContext (new CustomBinding (new
HttpTransportBindingElement () { AllowCookies = true }), new
BindingParameterCollection ());
+ }
+
+ BindingContext CreateBindingContext2 ()
+ {
+ return new BindingContext (new CustomBinding (new
TcpTransportBindingElement ()), new BindingParameterCollection ());
+ }
+
+ [Test]
+ public void CanBuildChannelFactory ()
+ {
+ // with HttpTransport
+ var m = new WebMessageEncodingBindingElement ();
+ Assert.IsTrue
(m.CanBuildChannelFactory<IRequestChannel> (CreateBindingContext ()), "#1");
+ Assert.IsFalse (m.CanBuildChannelFactory<IReplyChannel>
(CreateBindingContext ()), "#2");
+ Assert.IsFalse
(m.CanBuildChannelFactory<IRequestSessionChannel> (CreateBindingContext ()),
"#3");
+ Assert.IsFalse
(m.CanBuildChannelFactory<IDuplexChannel> (CreateBindingContext ()), "#4");
+
+ // actually they are from transport
+ var h = new HttpTransportBindingElement ();
+ Assert.IsTrue
(h.CanBuildChannelFactory<IRequestChannel> (CreateBindingContext ()), "#5");
+ Assert.IsFalse (h.CanBuildChannelFactory<IReplyChannel>
(CreateBindingContext ()), "#6");
+ Assert.IsFalse
(h.CanBuildChannelFactory<IRequestSessionChannel> (CreateBindingContext ()),
"#7");
+ Assert.IsFalse
(h.CanBuildChannelFactory<IDuplexChannel> (CreateBindingContext ()), "#8");
+
+ // with TcpTransport
+ Assert.IsFalse
(m.CanBuildChannelFactory<IRequestChannel> (CreateBindingContext2 ()), "#9");
+ Assert.IsFalse (m.CanBuildChannelFactory<IReplyChannel>
(CreateBindingContext2 ()), "#10");
+ Assert.IsFalse
(m.CanBuildChannelFactory<IRequestSessionChannel> (CreateBindingContext2 ()),
"#11");
+ Assert.IsFalse
(m.CanBuildChannelFactory<IDuplexChannel> (CreateBindingContext2 ()), "#12");
+
+ // ... yes, actually they are from transport
+ var t = new TcpTransportBindingElement ();
+ Assert.IsFalse
(t.CanBuildChannelFactory<IRequestChannel> (CreateBindingContext2 ()), "#13");
+ Assert.IsFalse (t.CanBuildChannelFactory<IReplyChannel>
(CreateBindingContext2 ()), "#14");
+ Assert.IsFalse
(t.CanBuildChannelFactory<IRequestSessionChannel> (CreateBindingContext2 ()),
"#15");
+ Assert.IsFalse
(t.CanBuildChannelFactory<IDuplexChannel> (CreateBindingContext2 ()), "#16");
+ }
+
+ [Test]
+ public void CanBuildChannelListener ()
+ {
+ // with HttpTransport
+ var m = new WebMessageEncodingBindingElement ();
+ Assert.IsFalse
(m.CanBuildChannelListener<IRequestChannel> (CreateBindingContext ()), "#1");
+ Assert.IsTrue (m.CanBuildChannelListener<IReplyChannel>
(CreateBindingContext ()), "#2");
+ Assert.IsFalse
(m.CanBuildChannelListener<IRequestSessionChannel> (CreateBindingContext ()),
"#3");
+ Assert.IsFalse
(m.CanBuildChannelListener<IDuplexChannel> (CreateBindingContext ()), "#4");
+
+ // actually they are from transport
+ var h = new HttpTransportBindingElement ();
+ Assert.IsFalse
(h.CanBuildChannelListener<IRequestChannel> (CreateBindingContext ()), "#5");
+ Assert.IsTrue
(h.CanBuildChannelListener<IReplyChannel> (CreateBindingContext ()), "#6");
+ Assert.IsFalse
(h.CanBuildChannelListener<IRequestSessionChannel> (CreateBindingContext ()),
"#7");
+ Assert.IsFalse
(h.CanBuildChannelListener<IDuplexChannel> (CreateBindingContext ()), "#8");
+
+ // with TcpTransport
+ Assert.IsFalse
(m.CanBuildChannelListener<IRequestChannel> (CreateBindingContext2 ()), "#9");
+ Assert.IsFalse
(m.CanBuildChannelListener<IReplyChannel> (CreateBindingContext2 ()), "#10");
+ Assert.IsFalse
(m.CanBuildChannelListener<IRequestSessionChannel> (CreateBindingContext2 ()),
"#11");
+ Assert.IsFalse
(m.CanBuildChannelListener<IDuplexChannel> (CreateBindingContext2 ()), "#12");
+
+ // ... yes, actually they are from transport
+ var t = new TcpTransportBindingElement ();
+ Assert.IsFalse
(t.CanBuildChannelListener<IRequestChannel> (CreateBindingContext2 ()), "#13");
+ Assert.IsFalse
(t.CanBuildChannelListener<IReplyChannel> (CreateBindingContext2 ()), "#14");
+ Assert.IsFalse
(t.CanBuildChannelListener<IRequestSessionChannel> (CreateBindingContext2 ()),
"#15");
+ Assert.IsFalse
(t.CanBuildChannelListener<IDuplexChannel> (CreateBindingContext2 ()), "#16");
+ }
+
+ [Test]
+ public void BuildChannelFactory ()
+ {
+ var m = new WebMessageEncodingBindingElement ();
+ var f = m.BuildChannelFactory<IRequestChannel>
(CreateBindingContext ());
+ Assert.AreEqual (f.GetType (), new
HttpTransportBindingElement ().BuildChannelFactory<IRequestChannel>
(CreateBindingContext ()).GetType (), "#1");
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches