public void GetAddress()
        {
            String address;

            address = GeoReferenceServer.GetAddress();
            Assert.IsTrue(address.IsNotEmpty());
        }
 public void CommitTransactionNoTransactionError()
 {
     using (DataServer database = new GeoReferenceServer())
     {
         database.CommitTransaction();
     }
 }
 public void Constructor()
 {
     using (WebServiceDataServer database = new GeoReferenceServer())
     {
         Assert.IsNotNull(database);
     }
 }
 public void Ping()
 {
     using (WebServiceDataServer database = new GeoReferenceServer())
     {
         Assert.IsTrue(database.Ping());
     }
 }
 public void BeginTransaction()
 {
     using (DataServer database = new GeoReferenceServer())
     {
         database.BeginTransaction();
     }
 }
 public void RollbackTransactionNoTransactionError()
 {
     using (DataServer database = new GeoReferenceServer())
     {
         database.RollbackTransaction();
     }
 }
 public void BeginTransactionAlreadyStartedError()
 {
     using (DataServer database = new GeoReferenceServer())
     {
         database.BeginTransaction();
         database.BeginTransaction();
     }
 }
 public void TestCleanup()
 {
     if (_database.IsNotNull())
     {
         _database.RollbackTransaction();
         _database.Dispose();
         _database = null;
     }
 }
 public void HasPendingTransaction()
 {
     using (DataServer database = new GeoReferenceServer())
     {
         Assert.IsFalse(database.HasPendingTransaction());
         database.BeginTransaction();
         Assert.IsTrue(database.HasPendingTransaction());
     }
 }
        public void Dispose()
        {
            using (DataServer database = new GeoReferenceServer())
            {
                database.Dispose();

                // Should be ok to dispose an already disposed database.
                database.Dispose();
            }
        }
        /// <summary>
        /// Get status for database.
        /// </summary>
        /// <param name='status'>Status for database is saved in this object.</param>
        private void GetDatabaseStatus(Dictionary <Int32, List <WebResourceStatus> > status)
        {
            Boolean           ping;
            String            address, informationEnglish, informationSwedish;
            WebResourceStatus resourceStatus;

            address = null;

            try
            {
                address            = GeoReferenceServer.GetAddress();
                informationEnglish = null;
                informationSwedish = null;
                using (GeoReferenceServer database = new GeoReferenceServer())
                {
                    ping = database.Ping();
                }
                if (!ping)
                {
                    informationEnglish = WebService.Settings.Default.DatabaseStatusErrorEnglish;
                    informationSwedish = WebService.Settings.Default.DatabaseStatusErrorSwedish;
                }
            }
            catch (Exception exception)
            {
                ping = false;
                informationEnglish = WebService.Settings.Default.DatabaseCommunicationFailureEnglish + " " +
                                     WebService.Settings.Default.ErrorMessageEnglish + " = " + exception.Message;
                informationSwedish = WebService.Settings.Default.DatabaseCommunicationFailureSwedish + " " +
                                     WebService.Settings.Default.ErrorMessageSwedish + " = " + exception.Message;
            }
            resourceStatus              = new WebResourceStatus();
            resourceStatus.AccessType   = WebService.Settings.Default.ResourceAccessTypeReadSwedish;
            resourceStatus.Address      = address;
            resourceStatus.Information  = informationSwedish;
            resourceStatus.Name         = DatabaseName.SwedishSpeciesObservation.ToString();
            resourceStatus.ResourceType = WebServiceBase.GetResourceType(ResourceTypeIdentifier.Database,
                                                                         (Int32)(LocaleId.sv_SE));
            resourceStatus.Status = ping;
            resourceStatus.Time   = DateTime.Now;
            status[(Int32)(LocaleId.sv_SE)].Add(resourceStatus);

            resourceStatus              = new WebResourceStatus();
            resourceStatus.AccessType   = WebService.Settings.Default.ResourceAccessTypeReadEnglish;
            resourceStatus.Address      = address;
            resourceStatus.Information  = informationEnglish;
            resourceStatus.Name         = DatabaseName.SwedishSpeciesObservation.ToString();
            resourceStatus.ResourceType = WebServiceBase.GetResourceType(ResourceTypeIdentifier.Database,
                                                                         (Int32)(LocaleId.en_GB));
            resourceStatus.Status = ping;
            resourceStatus.Time   = DateTime.Now;
            status[(Int32)(LocaleId.en_GB)].Add(resourceStatus);
        }
 private GeoReferenceServer GetDatabase(Boolean refresh = false)
 {
     if (_database.IsNull() || refresh)
     {
         if (_database.IsNotNull())
         {
             _database.RollbackTransaction();
             _database.Dispose();
         }
         _database = new GeoReferenceServer();
         _database.BeginTransaction();
     }
     return(_database);
 }
 public GeoReferenceServerTest()
 {
     _database = null;
 }