Fix XMM scanning on Mac x86.
[mono.git] / mcs / class / System.ServiceModel.Web / Test / System.ServiceModel.Configuration / WebHttpBindingElementTest.cs
1 #if !MOBILE
2 using System;
3 using System.ServiceModel.Configuration;
4 using NUnit.Framework;
5 using System.ServiceModel;
6 using System.Text;
7 using System.Configuration;
8
9 namespace MonoTests.System.ServiceModel.Configuration
10 {
11         [TestFixture]
12         public class WebHttpBindingElementTest
13         {
14                 class Poker : WebHttpBindingElement
15                 {
16                         public Type GetBindingElementType ()
17                         {
18                                 return BindingElementType;
19                         }
20                 }
21
22                 [Test]
23                 public void BindingElementType ()
24                 {
25                         Poker poker = new Poker ();
26                         Assert.AreEqual (typeof (WebHttpBinding), poker.GetBindingElementType (), "BindingElementType");
27                 }
28                 
29                 [Test]
30                 public void ApplyConfiguration ()
31                 {
32                         WebHttpBinding b = CreateBindingFromConfig ();
33
34                         Assert.AreEqual (true, b.AllowCookies, "#1");
35                         Assert.AreEqual (true, b.BypassProxyOnLocal, "#2");
36                         Assert.AreEqual (HostNameComparisonMode.Exact, b.HostNameComparisonMode, "#3");
37                         Assert.AreEqual (262144, b.MaxBufferPoolSize, "#4");
38                         Assert.AreEqual (32768, b.MaxBufferSize, "#5");
39                         Assert.AreEqual (16384, b.MaxReceivedMessageSize, "#6");
40                         Assert.AreEqual ("proxy", b.ProxyAddress.ToString (), "#7");
41                         Assert.AreEqual (Encoding.Unicode, b.WriteEncoding, "#8");
42                         Assert.AreEqual (TransferMode.Streamed, b.TransferMode, "#9");
43                 }
44                 
45                 [Test]
46                 public void Security ()
47                 {
48                         WebHttpBinding b = CreateBindingFromConfig ();
49                         Assert.AreEqual (WebHttpSecurityMode.TransportCredentialOnly, b.Security.Mode, "#1");
50                         Assert.AreEqual (HttpClientCredentialType.Basic, b.Security.Transport.ClientCredentialType, "#2");
51                         
52                 }
53                 
54                 private WebHttpBinding CreateBindingFromConfig ()
55                 {
56                         ServiceModelSectionGroup config = (ServiceModelSectionGroup) ConfigurationManager.OpenExeConfiguration ("Test/config/webHttpBinding").GetSectionGroup ("system.serviceModel");
57                         WebHttpBindingCollectionElement collectionElement = (WebHttpBindingCollectionElement) config.Bindings ["webHttpBinding"];
58                         
59                         WebHttpBindingElement el = collectionElement.Bindings ["WebHttpBinding1_Service"];
60
61                         WebHttpBinding b = new WebHttpBinding ();
62                         el.ApplyConfiguration (b);
63
64                         return b;
65                 }
66         }
67 }
68 #endif