ImportTests_Tests.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. //
  2. // Testcases.cs
  3. //
  4. // Author:
  5. // Martin Baulig <[email protected]>
  6. //
  7. // Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining a copy
  10. // of this software and associated documentation files (the "Software"), to deal
  11. // in the Software without restriction, including without limitation the rights
  12. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. // copies of the Software, and to permit persons to whom the Software is
  14. // furnished to do so, subject to the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be included in
  17. // all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. // THE SOFTWARE.
  26. using System;
  27. using System.Net;
  28. using System.Xml;
  29. using System.Text;
  30. using System.Collections.Generic;
  31. using System.ServiceModel;
  32. using System.ServiceModel.Channels;
  33. using System.ServiceModel.Description;
  34. using NUnit.Framework;
  35. using NUnit.Framework.Constraints;
  36. using NUnit.Framework.SyntaxHelpers;
  37. using WS = System.Web.Services.Description;
  38. namespace MonoTests.System.ServiceModel.MetadataTests {
  39. [TestFixture]
  40. [Category ("NotWorking")]
  41. [Category ("MetadataTests")]
  42. public partial class ImportTests {
  43. [Test]
  44. public void BasicHttp ()
  45. {
  46. var doc = TestContext.GetMetadata ("BasicHttp");
  47. var label = new TestLabel ("BasicHttp");
  48. BindingTestAssertions.BasicHttpBinding (doc, BasicHttpSecurityMode.None, label);
  49. }
  50. [Test]
  51. public void BasicHttp_TransportSecurity ()
  52. {
  53. var doc = TestContext.GetMetadata ("BasicHttp_TransportSecurity");
  54. var label = new TestLabel ("BasicHttp_TransportSecurity");
  55. BindingTestAssertions.BasicHttpBinding (doc, BasicHttpSecurityMode.Transport, label);
  56. }
  57. [Test]
  58. [Category ("NotWorking")]
  59. public void BasicHttp_MessageSecurity ()
  60. {
  61. var doc = TestContext.GetMetadata ("BasicHttp_MessageSecurity");
  62. var label = new TestLabel ("BasicHttp_MessageSecurity");
  63. BindingTestAssertions.BasicHttpBinding (doc, BasicHttpSecurityMode.Message, label);
  64. }
  65. [Test]
  66. [Category ("NotWorking")]
  67. public void BasicHttp_TransportWithMessageCredential ()
  68. {
  69. var doc = TestContext.GetMetadata ("BasicHttp_TransportWithMessageCredential");
  70. var label = new TestLabel ("BasicHttp_TransportWithMessageCredential");
  71. BindingTestAssertions.BasicHttpBinding (
  72. doc, BasicHttpSecurityMode.TransportWithMessageCredential, label);
  73. }
  74. [Test]
  75. public void BasicHttp_Mtom ()
  76. {
  77. var doc = TestContext.GetMetadata ("BasicHttp_Mtom");
  78. var label = new TestLabel ("BasicHttp_Mtom");
  79. BindingTestAssertions.BasicHttpBinding (
  80. doc, WSMessageEncoding.Mtom, label);
  81. }
  82. [Test]
  83. public void BasicHttp_NtlmAuth ()
  84. {
  85. var doc = TestContext.GetMetadata ("BasicHttp_NtlmAuth");
  86. var label = new TestLabel ("BasicHttp_NtlmAuth");
  87. BindingTestAssertions.BasicHttpBinding (
  88. doc, BasicHttpSecurityMode.TransportCredentialOnly, WSMessageEncoding.Text,
  89. HttpClientCredentialType.Ntlm, AuthenticationSchemes.Ntlm,
  90. label);
  91. }
  92. [Test]
  93. public void BasicHttps ()
  94. {
  95. var doc = TestContext.GetMetadata ("BasicHttps");
  96. var label = new TestLabel ("BasicHttps");
  97. BindingTestAssertions.BasicHttpsBinding (
  98. doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
  99. HttpClientCredentialType.None, AuthenticationSchemes.Anonymous,
  100. label);
  101. }
  102. [Test]
  103. public void BasicHttps_NtlmAuth ()
  104. {
  105. var doc = TestContext.GetMetadata ("BasicHttps_NtlmAuth");
  106. var label = new TestLabel ("BasicHttps_NtlmAuth");
  107. BindingTestAssertions.BasicHttpsBinding (
  108. doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
  109. HttpClientCredentialType.Ntlm, AuthenticationSchemes.Ntlm,
  110. label);
  111. }
  112. [Test]
  113. [Category ("NotWorking")]
  114. public void BasicHttps_Certificate ()
  115. {
  116. var doc = TestContext.GetMetadata ("BasicHttps_Certificate");
  117. var label = new TestLabel ("BasicHttps_Certificate");
  118. BindingTestAssertions.BasicHttpsBinding (
  119. doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
  120. HttpClientCredentialType.Certificate, AuthenticationSchemes.Anonymous,
  121. label);
  122. }
  123. [Test]
  124. [Category ("NotWorking")]
  125. public void BasicHttps_TransportWithMessageCredential ()
  126. {
  127. var doc = TestContext.GetMetadata ("BasicHttps_TransportWithMessageCredential");
  128. var label = new TestLabel ("BasicHttps_TransportWithMessageCredential");
  129. BindingTestAssertions.BasicHttpsBinding (
  130. doc, BasicHttpSecurityMode.TransportWithMessageCredential,
  131. WSMessageEncoding.Text, HttpClientCredentialType.None,
  132. AuthenticationSchemes.Anonymous, label);
  133. }
  134. [Test]
  135. public void NetTcp ()
  136. {
  137. var doc = TestContext.GetMetadata ("NetTcp");
  138. var label = new TestLabel ("NetTcp");
  139. BindingTestAssertions.NetTcpBinding (
  140. doc, SecurityMode.None, false, TransferMode.Buffered, label);
  141. }
  142. [Test]
  143. public void NetTcp_TransferMode ()
  144. {
  145. var doc = TestContext.GetMetadata ("NetTcp_TransferMode");
  146. var label = new TestLabel ("NetTcp_TransferMode");
  147. BindingTestAssertions.NetTcpBinding (
  148. doc, SecurityMode.None, false,
  149. TransferMode.Streamed, label);
  150. }
  151. [Test]
  152. public void NetTcp_TransportSecurity ()
  153. {
  154. var doc = TestContext.GetMetadata ("NetTcp_TransportSecurity");
  155. var label = new TestLabel ("NetTcp_TransportSecurity");
  156. BindingTestAssertions.NetTcpBinding (
  157. doc, SecurityMode.Transport, false,
  158. TransferMode.Buffered, label);
  159. }
  160. [Test]
  161. [Category ("NotWorking")]
  162. public void NetTcp_MessageSecurity ()
  163. {
  164. var doc = TestContext.GetMetadata ("NetTcp_MessageSecurity");
  165. var label = new TestLabel ("NetTcp_MessageSecurity");
  166. BindingTestAssertions.NetTcpBinding (
  167. doc, SecurityMode.Message, false,
  168. TransferMode.Buffered, label);
  169. }
  170. [Test]
  171. [Category ("NotWorking")]
  172. public void NetTcp_TransportWithMessageCredential ()
  173. {
  174. var doc = TestContext.GetMetadata ("NetTcp_TransportWithMessageCredential");
  175. var label = new TestLabel ("NetTcp_TransportWithMessageCredential");
  176. BindingTestAssertions.NetTcpBinding (
  177. doc, SecurityMode.TransportWithMessageCredential, false,
  178. TransferMode.Buffered, label);
  179. }
  180. [Test]
  181. public void NetTcp_Binding ()
  182. {
  183. var label = new TestLabel ("NetTcp_Binding");
  184. label.EnterScope ("None");
  185. BindingTestAssertions.CheckNetTcpBinding (
  186. new NetTcpBinding (SecurityMode.None), SecurityMode.None,
  187. false, TransferMode.Buffered, label);
  188. label.LeaveScope ();
  189. label.EnterScope ("Transport");
  190. BindingTestAssertions.CheckNetTcpBinding (
  191. new NetTcpBinding (SecurityMode.Transport), SecurityMode.Transport,
  192. false, TransferMode.Buffered, label);
  193. label.LeaveScope ();
  194. }
  195. [Test]
  196. [Category ("NotWorking")]
  197. public void NetTcp_Binding2 ()
  198. {
  199. var label = new TestLabel ("NetTcp_Binding2");
  200. label.EnterScope ("TransportWithMessageCredential");
  201. BindingTestAssertions.CheckNetTcpBinding (
  202. new NetTcpBinding (SecurityMode.TransportWithMessageCredential),
  203. SecurityMode.TransportWithMessageCredential, false,
  204. TransferMode.Buffered, label);
  205. label.LeaveScope ();
  206. }
  207. [Test]
  208. [Category ("NotWorking")]
  209. public void NetTcp_ReliableSession ()
  210. {
  211. var doc = TestContext.GetMetadata ("NetTcp_ReliableSession");
  212. var label = new TestLabel ("NetTcp_ReliableSession");
  213. BindingTestAssertions.NetTcpBinding (
  214. doc, SecurityMode.None, true,
  215. TransferMode.Buffered, label);
  216. }
  217. }
  218. }