WebHttpBindingTest.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.ServiceModel;
  2. using System.ServiceModel.Channels;
  3. using System.Text;
  4. using NUnit.Framework;
  5. namespace MonoTests.System.ServiceModel
  6. {
  7. [TestFixture]
  8. public class WebHttpBindingTest
  9. {
  10. [Test]
  11. public void DefaultPropertyValues ()
  12. {
  13. WebHttpBinding b = new WebHttpBinding ();
  14. Assert.AreEqual (EnvelopeVersion.None, b.EnvelopeVersion, "#1");
  15. Assert.AreEqual ("http", b.Scheme, "#1");
  16. Assert.AreEqual (Encoding.UTF8, b.WriteEncoding, "#2");
  17. Assert.AreEqual (0x10000, b.MaxBufferSize, "#3");
  18. #if !MOBILE
  19. Assert.AreEqual (0x80000, b.MaxBufferPoolSize, "#4");
  20. #endif
  21. Assert.AreEqual (0x10000, b.MaxReceivedMessageSize, "#5");
  22. Assert.IsFalse (((IBindingRuntimePreferences) b).ReceiveSynchronously, "#6");
  23. }
  24. [Test]
  25. public void CreateBindingElements ()
  26. {
  27. WebHttpBinding b = new WebHttpBinding ();
  28. BindingElementCollection bc = b.CreateBindingElements ();
  29. Assert.AreEqual (2, bc.Count, "#1");
  30. Assert.AreEqual (typeof (WebMessageEncodingBindingElement), bc [0].GetType (), "#2");
  31. Assert.AreEqual (typeof (HttpTransportBindingElement), bc [1].GetType (), "#3");
  32. }
  33. [Test]
  34. public void DefaultSchemeBasedOnSecurityMode ()
  35. {
  36. WebHttpBinding b = new WebHttpBinding(WebHttpSecurityMode.TransportCredentialOnly);
  37. Assert.AreEqual("http", b.Scheme, "#1");
  38. b = new WebHttpBinding(WebHttpSecurityMode.Transport);
  39. Assert.AreEqual("https", b.Scheme, "#2");
  40. }
  41. }
  42. }