2010-01-06 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Wed, 6 Jan 2010 03:17:29 +0000 (03:17 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Wed, 6 Jan 2010 03:17:29 +0000 (03:17 -0000)
* TestFixtureBase.cs : try to fix this mannerless set of tests that
  leaves comm objects open.

svn path=/trunk/mcs/; revision=149097

mcs/class/System.ServiceModel/Test/FeatureBased/ChangeLog
mcs/class/System.ServiceModel/Test/FeatureBased/TestFixtureBase.cs

index a817d810699c2efb75e3fd25a5d0d1490827897a..3fc80367a4ccec2cecf2ca0e326b7c72fcfef98f 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-06  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * TestFixtureBase.cs : try to fix this mannerless set of tests that
+         leaves comm objects open.
+
 2008-10-07  Atsushi Enomoto  <atsushi@ximian.com>
 
        * TestFixtureBase.cs : until I sort out what's causing failure on
index 5ebe51bfe7143828ac0b2cf5b667ac264ad2f3a3..211627b39c6f8ea78cc26519c8941362fb3ac6c1 100644 (file)
@@ -76,9 +76,19 @@ namespace MonoTests.Features
        public abstract class TestFixtureBase<TClient, TServer, IServer> where TClient : new() where TServer: new()
        {
                ServiceHost _hostBase;
+               ChannelFactory<IServer> factory;
 
                protected TestFixtureBase () { }                
 
+               [TearDown]
+               public void TearDown ()
+               {
+                       if (_hostBase != null)
+                               _hostBase.Close ();
+                       if (factory != null)
+                               factory.Close ();
+               }
+
                [SetUp]
                public virtual void Run (){
                        bool runServer = true;
@@ -169,7 +179,7 @@ namespace MonoTests.Features
 
                public IServer Client {
                        get {
-                               ChannelFactory<IServer> factory = new ChannelFactory<IServer> (new BasicHttpBinding (), new EndpointAddress (getEndpoint ()));
+                               factory = new ChannelFactory<IServer> (new BasicHttpBinding (), new EndpointAddress (getEndpoint ()));
                                return factory.CreateChannel ();
                        }
                }