CustomPeerResolverServiceTest.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. //
  2. // CustomPeerResolverServiceTest.cs
  3. //
  4. // Author:
  5. // Marcos Cobena ([email protected])
  6. //
  7. // Copyright 2007 Marcos Cobena (http://www.youcannoteatbits.org/)
  8. //
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ServiceModel;
  12. using System.ServiceModel.Description;
  13. using System.ServiceModel.PeerResolvers;
  14. using System.Text;
  15. using NUnit.Framework;
  16. namespace MonoTests.System.ServiceModel.PeerResolvers
  17. {
  18. [TestFixture]
  19. public class CustomPeerResolverServiceTest
  20. {
  21. private CustomPeerResolverService cprs;
  22. [SetUp]
  23. protected void SetUp ()
  24. {
  25. cprs = new CustomPeerResolverService ();
  26. }
  27. [Test]
  28. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  29. public void CloseTest ()
  30. {
  31. cprs.Open ();
  32. cprs.Close ();
  33. }
  34. [Test]
  35. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  36. [ExpectedException (typeof (InvalidOperationException))]
  37. public void CloseTest1 ()
  38. {
  39. cprs.Close ();
  40. }
  41. [Test]
  42. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  43. [ExpectedException (typeof (InvalidOperationException))]
  44. public void GetServiceSettingsTest ()
  45. {
  46. ServiceSettingsResponseInfo ssri;
  47. ssri = cprs.GetServiceSettings ();
  48. }
  49. [Test]
  50. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  51. public void OpenTest ()
  52. {
  53. cprs.Open ();
  54. }
  55. [Test]
  56. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  57. [ExpectedException (typeof (ArgumentException))]
  58. public void OpenTest1 ()
  59. {
  60. cprs.CleanupInterval = TimeSpan.Zero;
  61. cprs.Open ();
  62. }
  63. [Test]
  64. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  65. [ExpectedException (typeof (ArgumentException))]
  66. public void OpenTest2 ()
  67. {
  68. cprs.RefreshInterval = TimeSpan.Zero;
  69. cprs.Open ();
  70. }
  71. [Test]
  72. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  73. [ExpectedException (typeof (ArgumentException))]
  74. public void OpenTest3 ()
  75. {
  76. cprs.CleanupInterval = TimeSpan.Zero;
  77. cprs.RefreshInterval = TimeSpan.Zero;
  78. cprs.Open ();
  79. }
  80. [Test]
  81. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  82. [ExpectedException (typeof (InvalidOperationException))]
  83. public void OpenTest4 ()
  84. {
  85. cprs.Open ();
  86. cprs.Open ();
  87. }
  88. [Test]
  89. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  90. [ExpectedException (typeof (ArgumentException))]
  91. public void RefreshTest ()
  92. {
  93. cprs.Refresh (null);
  94. }
  95. [Test]
  96. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  97. [ExpectedException (typeof (InvalidOperationException))]
  98. public void RefreshTest1 ()
  99. {
  100. cprs.Refresh (new RefreshInfo ());
  101. }
  102. //[Test]
  103. //public void RefreshTest2 ()
  104. //{
  105. // cprs.Open ();
  106. // cprs.Refresh(new RefreshInfo ("foo", new Guid ()));
  107. //}
  108. [Test]
  109. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  110. [ExpectedException (typeof( ArgumentException))]
  111. public void RegisterTest ()
  112. {
  113. cprs.Register (null);
  114. }
  115. [Test]
  116. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  117. [ExpectedException (typeof (InvalidOperationException))]
  118. public void RegisterTest1 ()
  119. {
  120. cprs.Register (new RegisterInfo ());
  121. }
  122. //[Test]
  123. //public void RegisterTest2 ()
  124. //{
  125. // cprs.Open ();
  126. // cprs.Register(new RegisterInfo ());
  127. //}
  128. [Test]
  129. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  130. [ExpectedException (typeof (ArgumentException))]
  131. public void ResolveTest ()
  132. {
  133. cprs.Resolve (null);
  134. }
  135. [Test]
  136. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  137. [ExpectedException (typeof (InvalidOperationException))]
  138. public void ResolveTest1 ()
  139. {
  140. cprs.Resolve (new ResolveInfo ());
  141. }
  142. //[Test]
  143. //public void ResolveTest2 ()
  144. //{
  145. // cprs.Open ();
  146. // cprs.Resolve (new ResolveInfo ());
  147. //}
  148. [Test]
  149. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  150. [ExpectedException (typeof (ArgumentException))]
  151. public void UnregisterTest ()
  152. {
  153. cprs.Unregister (null);
  154. }
  155. [Test]
  156. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  157. [ExpectedException (typeof (InvalidOperationException))]
  158. public void UnregisterTest1 ()
  159. {
  160. cprs.Unregister (new UnregisterInfo ());
  161. }
  162. //[Test]
  163. //public void UnregisterTest2 ()
  164. //{
  165. // cprs.Open ();
  166. // cprs.Unregister (new UnregisterInfo ());
  167. //}
  168. [Test]
  169. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  170. [ExpectedException (typeof (ArgumentException))]
  171. public void UpdateTest ()
  172. {
  173. cprs.Update (null);
  174. }
  175. [Test]
  176. [Category ("NotWorking")] // It somehow stopped working properly recently in Nov. 2009, not sure where the source of the problem lies.
  177. [ExpectedException (typeof (InvalidOperationException))]
  178. public void UpdateTest1 ()
  179. {
  180. cprs.Update (new UpdateInfo ());
  181. }
  182. //[Test]
  183. //public void UpdateTest2 ()
  184. //{
  185. // cprs.Open ();
  186. // cprs.Update (new UpdateInfo ());
  187. //}
  188. [Test]
  189. public void Contract ()
  190. {
  191. var cd = ContractDescription.GetContract (typeof (IPeerResolverContract));
  192. Assert.IsNull (cd.CallbackContractType, "#1");
  193. Assert.AreEqual (typeof (IPeerResolverContract), cd.ContractType, "#2");
  194. Assert.AreEqual (SessionMode.Allowed, cd.SessionMode, "#3");
  195. }
  196. }
  197. }