title: NUnit extension
body: <p>Hi All i have a question regarding NUnit Extension (2.5.10). 
  What i am trying to do is write some additional test info to the 
  database. For that i have created NUnit extension using Event 
  Listeners. 
  The problem i am experiencing is that public void 
  TestFinished(TestResult result) method is being called twice at 
  runtime. And my code which writes to the database is in this method 
  and that leaves me with duplicate entries in the database. The 
  question is: Is that the expected behaviour? Can i do something about 
  it? 
  The extension code is below. Thanks.</p>
  
  <pre><code>using System;
  using NUnit.Core;
  using NUnit.Core.Extensibility;
  
  namespace NuinitExtension
  {
  [NUnitAddinAttribute(Type = ExtensionType.Core,
                       Name = "Database Addin", 
                       Description = "Writes test results to the database.")]
  public class MyNunitExtension : IAddin, EventListener
  {
      public bool Install(IExtensionHost host)
      {
          IExtensionPoint listeners = host.GetExtensionPoint("EventListeners");
          if (listeners == null)
              return false;
  
          listeners.Install(this);
          return true;
      }
  
      public void RunStarted(string name, int testCount){}
      public void RunFinished(TestResult result){}
      public void RunFinished(Exception exception){}
      public void TestStarted(TestName testName){}
  
      public void TestFinished(TestResult result)
      {
          // this is just sample data
          SqlHelper.SqlConnectAndWRiteToDatabase("test", test", 
                                                 2.0, DateTime.Now);
      }
  
      public void SuiteStarted(TestName testName){}
      public void SuiteFinished(TestResult result){}
      public void UnhandledException(Exception exception){}
      public void TestOutput(TestOutput testOutput){}
  }
  </code></pre>
  
  <p>}</p>